2013-04-25 58 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"); 

這將解決這一問題。