2013-02-25 53 views
1

發現Firefox的二進制我得到錯誤:不能在路徑

Failed: org.openqa.selenium.WebDriverException Cannot find firefox binary in PATH, make sure firefox is installed. OS appears to be WIN8 

我對windows 8 64bit

相同的代碼使用Selenium v 2.30Firefox v.19已於Windows7的/ SP1完美的工作。

if(browser == SupportedBrowser.FIREFOX) {   
      //firefox driver is built into selenium standalone server 
      return new FirefoxDriver(); 
     } 
+1

那麼你的PATH中的firefox二進制文件呢?檢查你的環境變量。 – 2013-02-25 07:03:43

+0

嘗試將firefox版本降級到18並檢查它是否可用! – Hemanth 2013-02-25 07:24:06

回答

3
  1. 打開命令行(開始 - >運行 - >輸入 「cmd」)
  2. PATH
  3. 驗證您可以在這裏看到書面firefox.exe地方

它自己做無助於改變這樣的構造:

if(browser == SupportedBrowser.FIREFOX) { 
    File pathToBinary = new File("path/to/firefox.exe"); 
    FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary); 
    FirefoxProfile firefoxProfile = new FirefoxProfile(); 
    FirefoxDriver _driver = new FirefoxDriver(ffBinary,firefoxProfile); 
    return _driver; 
} 
0

你可以做

System.setProperty("webdriver.firefox.bin","PATH_TO_BINARY");