无法在当前系统上找到Firefox(Firefox 47)



在Firefox自动升级为47版后,硒停止工作。我遵循Mozilla建议的有关Marionette驱动程序的JavaScript(Node.js)步骤,但该控制台表示它在我当前的系统上找不到Firefox,但是浏览器的路径是良好且标准的。错误是"无法在当前系统上找到Firefox"在C: users \ node_modules selenium-webdriver firefox binary.js:115:11

如果很重要,我使用webdriverjs。

我已经发生了这种情况,而且似乎总是很随机。这是一个漫长的镜头,但尝试更改路径,然后将原始后背放回过去。

我遇到了类似的问题,发现在GG组中讨论了Firefox 47和WebDriver(JS和其他语言)似乎存在很多问题。您现在唯一的解决方案可能是降级-https://ftp.mozilla.org/pub/firefox/releases/46.0.1/

诚然,降级无法解决我的问题,但是ymmv

我遇到了相同的问题,并通过从https://www.mozilla.org/en-us/firefox/developer/下载开发人员版来解决。显然,使用Firefox的开发人员版本存在一些冲突。
在node_modules/selenium-webdriver/firefox/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);

选择了开发程序,但我没有它,这导致发现为null,后来在第115行中丢下了错误。

可能是您的Firefox未安装在默认位置吗?我的C:Users(username)AppDataLocalMozilla Firefox中安装了我的,我收到与您相同的错误消息。

浏览代码(谢谢@achie),我在node_modulesselenium-webdriverfirefoxindex.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的路径变量中甚至没有任何用处。

但是源代码继续:

* 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();,但这没有任何区别。

希望这对您有所帮助!

Mozilla的人们建议使用Marionette驱动程序,因为Selenium Webdriver有启动崩溃问题2.53和Firefox 47/48

https://developer.mozilla.org/en-us/docs/mozilla/qa/marionette/webdriver

最新的Firefox 48和Selenium Webdriver 3.0.0解决了此特定问题。

最新更新