【问题标题】:Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055无法连接到端口 7055 上的二进制 FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe)
【发布时间】:2012-02-10 18:34:18
【问题描述】:

我正在尝试将 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>
    

在运行集成测试时(firefox 打开一个空白页面),我得到以下异常:

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

更新:我使用的是 firefox 9。

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

    • 在使用带有 WebDriver 的 FF 12 时,我也遇到了以下错误:org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on端口 7055;进程输出如下:null 我停止了FF的自动更新,效果很好。
    【解决方案2】:

    使用以下依赖后错误消失了:

            <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>
    

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题。 如果您有该版本并且仍然出现问题,则该错误已在 v36.01 中修复,请重新安装它

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-03-02
        • 2020-04-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-07-02
        • 2013-09-02
        • 1970-01-01
        相关资源
        最近更新 更多