我正在尝试使用 Firefox 在 Amazon Linux 上运行 nodeJs (node v 8.8.1) 自动化测试。由于 Amazon Linux 的一些限制,实际运行的最新版本的 firefox taht 是 41。下面是我的 Firefox 和 Amazon 版本...
[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 与此版本的 Firefox 兼容?使用最新版本,我们在尝试生成 Firefox 窗口时遇到错误,并且路径中没有壁虎驱动程序,我们会收到错误
/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