2016-06-14 36 views
0

Firefox自升級至版本47後,Selenium停止工作。 我遵循Mozilla建議的有關Marionette驅動程序的Javascript(Node.js)步驟,但控制檯說它無法在我當前的系統上找到Firefox,但瀏覽器的路徑很好且標準。 錯誤是位於C 「在當前系統中無法找到火狐」:\用戶\\ node_modules \硒的webdriver \火狐\ binary.js:115:11無法在當前系統上找到Firefox(Firefox 47)

如果它的事項,我用WebdriverJS。

回答

0

最新的Firefox 48和硒的webdriver 3.0.0推薦解決了這個特殊問題。

0

我已經發生過這種情況,它似乎總是非常隨機的。這是一個長鏡頭,但嘗試改變路徑,然後把原來的東西放回去,這在過去對我很有用。

-1

我有同樣的問題。現在必須從測試中刪除Firefox。

0

我有同樣的問題,並通過從https://www.mozilla.org/en-US/firefox/developer/下載開發版來解決它。顯然,使用Firefox的開發者版本存在一些衝突。
在node_modules /硒的webdriver /火狐/ binary.js,99行,此代碼:

let exe = opt_dev 
 
     ? '/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin' 
 
     : '/Applications/Firefox.app/Contents/MacOS/firefox-bin'; 
 
    found = io.exists(exe).then(exists => exists ? exe : null);

選擇了DeveloperEdition,但我沒有它,導致發現爲空,稍後會在第115行中引發錯誤。

0

難道您的Firefox未安裝在默認位置?我的安裝在C:\Users\(username)\AppData\Local\Mozilla Firefox\,我得到了和你一樣的錯誤信息。

瀏覽代碼(感謝@achie),我發現在node_modules\selenium-webdriver\firefox\index.js如下:

* On Windows and OSX, the FirefoxDriver will search for Firefox in its 
* default installation location: 
* 
* * Windows: C:\Program Files and C:\Program Files (x86). 
* * Mac OS X: /Applications/Firefox.app 
* 
* For Linux, Firefox will be located on the PATH: `$(where firefox)`. 

換句話說,它甚至沒有任何用處把Firefox的目錄在Windows PATH變量。

但源代碼繼續:

* You can configure WebDriver to start use a custom Firefox installation with 
* the {@link Binary} class: 
* 
*  var firefox = require('selenium-webdriver/firefox'); 
*  var binary = new firefox.Binary('/my/firefox/install/dir/firefox-bin'); 
*  var options = new firefox.Options().setBinary(binary); 
*  var driver = new firefox.Driver(options); 

在我的情況下,就變成了:

var firefox = require('selenium-webdriver/firefox'); 
var binary = new firefox.Binary('C:\\Users\\(username)\\AppData\\Local\\Mozilla Firefox\\firefox.exe'); 
var options = new firefox.Options().setBinary(binary); 
var driver = new firefox.Driver(options); 

現在硒發現我的Firefox,但我得到下一個錯誤信息:

Error: Timed out waiting for the WebDriver server at http://127.0.0.1:53785/hub 

我也試過var driver = new webdriver.Builder().forBrowser('firefox').setFirefoxOptions(options).build();,但是沒有什麼區別。

希望這可以幫助你更進一步!