2013-04-25 60 views
4

PATH运行测试Firefox的二进制我不断收到以下错误,当我尝试运行在硒IDE与webdriver的播放测试。接收org.openqa.selenium.WebDriverException:无法找到在硒IDE与webdriver的播放

Caused by: org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: VISTA 
Build info: version: ’2.32.0′, revision: ’6c40c18′, time: ’2013-04-09 17:22:56′ 
System info: os.name: ‘Windows 7′, os.arch: ‘amd64′, os.version: ’6.1′, java.version: ’1.6.0_39′ 
Driver info: driver.version: FirefoxDriver 
at org.openqa.selenium.firefox.internal.Executable.(Executable.java:72) 
at org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:59) 
at org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:55) 
at org.openqa.selenium.firefox.FirefoxDriver.getBinary(FirefoxDriver.java:175) 
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:100) 
… 14 more 

该错误提到在PATH中找不到firefox二进制文件。我更新了路径中的Firefox二进制文件,但仍然收到相同的错误消息。测试用例中使用的函数是一个自定义的case和waitforelementpresent。

这是我在我的路径C的变量值:\程序文件(x86)\火狐ESR 17

我怎样才能解决这个问题?

回答

0

添加整个路径包括如下图所示的路径的exe文件的名称。

C:\Program Files (x86)\Firefox ESR 17\firefox.exe 
2

我也遭受同样的问题。最后,我通过在capabilites中设置二进制值来解决它,如下所示。在运行时它使用这个值,所以它必须设置。

DesiredCapabilities capability = DesiredCapabilities.firefox(); 
capability.setCapability("platform", Platform.ANY); 
capability.setCapability("binary", "/ms/dist/fsf/PROJ/firefox/16.0.0/bin/firefox"); //for linux 

//capability.setCapability("binary", "C:\\Program Files\\Mozilla Firefox\\msfirefox.exe"); //for windows     
WebDriver currentDriver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability); 

你就完成了!快乐编码:)

5

我更新了环境变量路径,但它并没有为我工作。最后不要添加firefox.exe E:\安装\ Firefox Mozilla。并重新启动日食。它为我工作。

0

我也曾经有过同样的问题,但不知何故,我解决了这个问题通过,

  1. 更新我的JAR文件: 硒-java的2.43.0.jar硒-Java的2.48.2.jar硒服务器独立-2.43.1.jar硒的服务器独立-2.48.2.jar
  2. 增加了一个新的JAR文件本身lenium的Java-2.48.2-srcs.jar到LIB

这些变化使我的代码完美无瑕的在我的情况

0

的硒,如果你使用的是Chrome驱动程序,然后组织。 openqa。硒。 WebDriverException主要显示chrome何时发布新的chrome驱动程序。因此,请尝试使用最新的chrome驱动程序,并检查问题是否已解决。

0

做只要指定路径:

System.setProperty("webdriver.firefox.bin", "C:\\Program Files\\Mozilla Firefox\\firefox.exe"); 

这将解决这一问题。