我想運行硒測試作爲maven構建的一部分,這是我的參考: http://www.gitshah.com/2010/10/how-to-run-selenium-tests-as-part-of.html?showComment=1326627249570#c2296284119877744512無法連接到二進制FirefoxBinary(C: Program Files文件(x86) Mozilla Firefox firefox.exe)端口7055
依賴:
<dependency> <groupId>org.seleniumhq.selenium.client-drivers</groupId> <artifactId>selenium-java-client-driver</artifactId> <version>1.0.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.seleniumhq.webdriver</groupId> <artifactId>webdriver-firefox</artifactId> <version>0.9.7376</version> </dependency>
插件:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> </plugin> <!-- Selenium plugin to start selenium server --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>selenium-maven-plugin</artifactId> <executions> <execution> <id>start</id> <phase>pre-integration-test</phase> <goals> <goal>start-server</goal> </goals> <configuration> <background>true</background> <logOutput>true</logOutput> </configuration> </execution> <execution> <id>stop</id> <phase>post-integration-test</phase> <goals> <goal>stop-server</goal> </goals> </execution> </executions> </plugin> <!-- Cargo plugin to start servlet container when integration test runs --> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <configuration> <wait>false</wait> <container> <containerId>tomcat7x</containerId> <type>installed</type> <home>${env.CATALINA_HOME}</home> </container> </configuration> <executions> <execution> <id>start-container</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> <goal>deploy</goal> </goals> </execution> <execution> <id>stop-container</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.8</version> <configuration> <junitArtifactName> org.junit:com.springsource.org.junit </junitArtifactName> <excludes> <exclude>**/unit/*Test.java</exclude> </excludes> </configuration> <executions> <execution> <id>integration-tests</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> <skip>false</skip> <excludes> <exclude>none</exclude> </excludes> <includes> <include>**/integration/*Test.java</include> </includes> </configuration> </execution> </executions> </plugin>
(火狐打開一個空白頁),我收到以下異常:
Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055
UPDATE:我使用的Firefox 9
在WebDriver中使用FF 12時出現以下錯誤: org.openqa.selenium.WebDriverException:無法連接到二進制FirefoxBinary(C:\ Program Files \ Mozilla Firefox \ firefox.exe)在端口7055;過程輸出如下: null 我停止了FF的自動更新,它運行良好。 – 2012-11-20 05:31:02