我正在尝试使用Firefox在Amazon Linux上运行nodeJs(node v 8.8.1)自动化测试。由于亚马逊Linux的一些限制,最新版本的firefox taht实际运行的是41.以下是我的Firefox和亚马逊版本......
[myuser@mymachine ~]$ firefox -v
Mozilla Firefox 41.0
[myuser@mymachine ~]$ uname -a
Linux ip-33-22-3-77 4.9.51-10.52.amzn1.x86_64 #1 SMP Fri Sep 29 01:16:19 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
我的问题是,我使用的是什么版本的Geckodriver taht与此版本的Firefox兼容?使用最新版本我们在尝试生成Firefox窗口并且在我们的路径中没有gecko驱动程序时出错,我们得到错误
/home/jboss/node_modules/selenium-webdriver/firefox/index.js:354
throw Error(
^
Error: The geckodriver executable could not be found on the current PATH. Please download the latest version from https://github.com/mozilla/geckodriver/releases/ and ensure it can be found on your PATH.
at findGeckoDriver (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:354:11)
at new ServiceBuilder (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:446:22)
at Function.createSession (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:516:21)
at createDriver (/home/jboss/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/home/jboss/node_modules/selenium-webdriver/index.js:645:16)
at Object.<anonymous> (/home/jboss/.jenkins/workspace/subco/automated-tests/nodejs/js/js-FF/driver.js:9:73)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
/home/jboss/node_modules/selenium-webdriver/firefox/index.js:354
throw Error(
^
Error: The geckodriver executable could not be found on the current PATH. Please download the latest version from https://github.com/mozilla/geckodriver/releases/ and ensure it can be found on your PATH.
at findGeckoDriver (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:354:11)
at new ServiceBuilder (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:446:22)
at Function.createSession (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:516:21)
at createDriver (/home/jboss/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/home/jboss/node_modules/selenium-webdriver/index.js:645:16)
at Object.<anonymous> (/home/jboss/.jenkins/workspace/subco/automated-tests/nodejs/js/js-FF/driver.js:9:73)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
/home/jboss/node_modules/selenium-webdriver/firefox/index.js:354
throw Error(
^
Error: The geckodriver executable could not be found on the current PATH. Please download the latest version from https://github.com/mozilla/geckodriver/releases/ and ensure it can be found on your PATH.
at findGeckoDriver (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:354:11)
at new ServiceBuilder (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:446:22)
at Function.createSession (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:516:21)
at createDriver (/home/jboss/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/home/jboss/node_modules/selenium-webdriver/index.js:645:16)
at Object.<anonymous> (/home/jboss/.jenkins/workspace/subco/automated-tests/nodejs/js/js-FF/driver.js:9:73)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
/home/jboss/node_modules/selenium-webdriver/firefox/index.js:354
throw Error(
^
Error: The geckodriver executable could not be found on the current PATH. Please download the latest version from https://github.com/mozilla/geckodriver/releases/ and ensure it can be found on your PATH.
at findGeckoDriver (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:354:11)
at new ServiceBuilder (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:446:22)
at Function.createSession (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:516:21)
at createDriver (/home/jboss/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/home/jboss/node_modules/selenium-webdriver/index.js:645:16)
at Object.<anonymous> (/home/jboss/.jenkins/workspace/subco/automated-tests/nodejs/js/js-FF/driver.js:9:73)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
ERROR: Maven JVM terminated unexpectedly with exit code 137
编辑:根据答案,我删除并重新安装了Selenium 2.53驱动程序......
npm uninstall selenium-webdriver
npm install selenium-webdriver@2.53
但现在我收到了新的错误......
Error: The wires executable could not be found on the current PATH. Please download the latest version from https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver and ensure it can be found on your PATH.
at findWires (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:261:11)
at createWiresService (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:285:15)
at new Driver (/home/jboss/node_modules/selenium-webdriver/firefox/index.js:355:21)
at Builder.build (/home/jboss/node_modules/selenium-webdriver/builder.js:467:16)
at Object.<anonymous> (/home/jboss/.jenkins/workspace/subco/automated-tests/nodejs/js/js-FF/driver.js:9:73)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
at Function.Module._load (module.js:486:3)
/home/jboss/node_modules/selenium-webdriver/firefox/index.js:261
答案 0 :(得分:0)
由于firefox版本为41,使用selenium 2很好,如果我们使用selenium 3意味着最新,我们需要不支持这个旧版本的gecko。
我使用selenium 2和firefox依赖http://selenium-release.storage.googleapis.com/index.html?path=2.53/一起使用最新的chrome和IE驱动程序来使用最新的chrome和IE浏览器。
答案 1 :(得分:0)
我认为,您收到该错误是因为它要求":type-facet:" + type; or ":category:" + category
。 Geckodriver最初被称为version 0.8.0之前的电线。请在您的系统路径上提供exe。
您可以通过将此属性设置为false来使用selenium 3(我认为这是最好的选项,因为它是最新的)而不提供gecko(早期的FF版本)
:category:(-\"CategoryA\")
或做
geckodriver.exe
您可能必须查找等效的nodejs。
编辑: here是js版本
System.setProperty("webdriver.firefox.marionette", "false");
当您执行上述操作时,FF将使用其旧版扩展程序而不是gecko
如上所述here
如果您想了解有关木偶客户端 - 服务器 - 壁虎互动的更多信息,可以查看相关问题here。
答案 2 :(得分:0)
为亚马逊Linux证明了正确的版本Firefox 41是selenium-webdriver 2.50,不多也不少(试过2.48和2.53并且两者都失败了)。