- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我正在运行一些 Selenium 测试。当我直接从 Eclipse 启动它们时,一切正常。但是当我通过 Maven 启动它们时,会出现以下异常:
org.openqa.selenium.WebDriverException(Failed to connect to binary FirefoxBinary(C:\winapp\Firefox\firefox.exe) on port 7055; process output follows:
null
Build info: version: '2.26.0', revision: '18040', time: '2012-11-02 09:44:45'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_35'
Driver info: driver.version: FirefoxDriver)
我使用的是 Firefox 10.0.10 ESR。我也用 Selenium 2.25.0 尝试过。
这是我最新版本的 pom.xml:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.26.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.26.0</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.3</version>
</dependency>
</dependencies>
如果我可以为您提供更多信息,请告诉我。
编辑:更新 pom.xml
edit2:最让我惊奇的是,我可以从 Eclipse 运行测试而不会出现 ans 问题。例如,如果我调用“mvn install”,它们就会发生
最佳答案
当我遇到此错误时,通常是以下两种情况之一。
Selenium 版本不支持浏览器版本从 Eclipse 与 Maven 运行时,仔细检查 Selenium/浏览器版本是否相同。仔细检查 Eclipse 和 Maven 配置为使用相同的 Selenium 版本。当我的浏览器自动更新时发生这种情况,所以我在浏览器中关闭了它。
Selenium 测试以 headless 模式运行如果您在与 Eclipse 相同的机器上手动执行 mvn,则不太可能。在我的 Jenkins 服务器上通过 Maven 运行 Selenium 时,这发生在我身上。 Jenkins 服务器以 headless 模式运行。花了我一分钟才弄清楚 headless 的东西,我想我在 Linux 中设置了一个 DISPLAY 环境变量或其他东西。
关于java - 无法在 Maven 中使用 Selenium 连接到二进制 FirefoxBinary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13514338/
这个方法有什么意义FirefoxBinary#startProfile ? 如何控制使用上述方法打开的浏览器? FirefoxBinary binary = new FirefoxBinary(new
星期三,我的代码成功了。我今天回来,我的代码不再有效。没有人碰过它,包括我自己。我收到以下错误消息: 'FirefoxBinary' object has no attribute '_get_fir
我正在运行一些 Selenium 测试。当我直接从 Eclipse 启动它们时,一切正常。但是当我通过 Maven 启动它们时,会出现以下异常: org.openqa.selenium.WebDriv
我正在尝试使用 webdriver 启动 Firefox 实例,但我想指示它使用某些 xvfb 显示。不过,我认为我的代码有问题 FirefoxBinary ffox = new Firefox
我正在使用 selenium 在 Java 上运行测试。 当我运行样本测试时。我得到以下内容 Build info: version: '2.47.2', revision: '4d972c01cab
FirefoxBinary 中的方法 startProfile(FirefoxProfile, File, String) 是否已弃用? 我已经在我的java项目中导入了最新的selenium jar
当我在 Eclipse 中运行 Selenium-Webdriver 脚本时,它工作正常。但是相同的脚本在服务器机器的 jenkins 中运行,它给出了以下错误: 18:00:34 ---------
我正在使用 FireFox 18 和 Selenium 2.29.0。运行测试时出现异常 无法连接到端口 7056 上的二进制 FirefoxBinary(C:\Program Files (x86)
使用Selenium 3.1.0,firefox最新版本72.0,默认firefox驱动2.53.1 这是我的代码 System.setProperty("webdriver.gecko.driver
我是一名优秀的程序员,十分优秀!