无法连接到端口7055上的二进制FirefoxBinary(C:\ Program Files(x86)\ Mozilla Firefox \ firefox.exe)

时间:2012-01-15 12:07:15

标签: spring java-ee maven selenium continuous-integration

我正在尝试运行selenium测试作为maven构建的一部分,这是我的参考: http://www.gitshah.com/2010/10/how-to-run-selenium-tests-as-part-of.html?showComment=1326627249570#c2296284119877744512

  1. 依赖关系

        <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>
    
  2. 插件

         <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>
    
  3. 运行集成测试时(firefox打开一个空白页面),我收到以下异常:

     Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055
    

    更新:我正在使用firefox 9。

3 个答案:

答案 0 :(得分:1)

至少需要Selenium 2.15版才能支持Firefox 9(参考http://selenium.googlecode.com/svn/trunk/java/CHANGELOG)。

答案 1 :(得分:0)

使用以下依赖项后,

错误消失了:

        <dependency>
          <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium-firefox-driver</artifactId>
          <version>2.16.1</version>         
        </dependency>

并删除这一个:

<dependency>
   <groupId>org.seleniumhq.webdriver</groupId>
   <artifactId>webdriver-firefox</artifactId>
   <version>0.9.7376</version>
</dependency>

答案 2 :(得分:0)

我遇到了同样的问题。 如果您有该版本并且问题仍然会再次重新安装,那么该错误已在v36.01中修复