I have this code in my Cucumber Hooks file to run the ghost driver it was working until yesterday I start seeing the error message:
我在我的Cucumber Hooks文件中有这个代码来运行它正在工作的ghost驱动程序,直到昨天我开始看到错误消息:
Before do
Selenium::WebDriver::PhantomJS.path = 'C:\phantomjs-2.1.1-windows\bin\phantomjs.exe'
@browser = Watir::Browser.start "https://www.google.com", :phantomjs
@browser.window.maximize
end
Error message:
错误信息:
LoadError: cannot load such file -- selenium/webdriver/phantomjs
2 个解决方案
#1
2
Yes, we've removed support for PhantomJS as of Selenium 3.8. The PhantomJS project is no longer being maintained. If you actually do need headless, please investigate either the Chrome or Firefox headless options.
是的,我们已从Selenium 3.8中删除了对PhantomJS的支持。 PhantomJS项目不再维护。如果您确实需要无头,请调查Chrome或Firefox无头选项。
#2
2
For those who encounter this error, you can work around it by locking your selenium-webdriver version in your Gemfile like so:
对于那些遇到此错误的人,您可以通过在Gemfile中锁定selenium-webdriver版本来解决此问题,如下所示:
gem 'selenium-webdriver', '~> 3.6.0'
and then bundle update
to downgrade.
然后将更新捆绑到降级。
(You may not even have selenium-webdriver specified in your Gemfile currently if it's just being loaded as a dependency of watir or some other library.)
(如果它只是作为watir或其他库的依赖项加载,你当前可能没有在你的Gemfile中指定selenium-webdriver。)
The long term fix, of course, is to move off of PhantomJS to Chrome or Firefox headless.
当然,长期解决方案是将PhantomJS移至Chrome或Firefox无头。
#1
2
Yes, we've removed support for PhantomJS as of Selenium 3.8. The PhantomJS project is no longer being maintained. If you actually do need headless, please investigate either the Chrome or Firefox headless options.
是的,我们已从Selenium 3.8中删除了对PhantomJS的支持。 PhantomJS项目不再维护。如果您确实需要无头,请调查Chrome或Firefox无头选项。
#2
2
For those who encounter this error, you can work around it by locking your selenium-webdriver version in your Gemfile like so:
对于那些遇到此错误的人,您可以通过在Gemfile中锁定selenium-webdriver版本来解决此问题,如下所示:
gem 'selenium-webdriver', '~> 3.6.0'
and then bundle update
to downgrade.
然后将更新捆绑到降级。
(You may not even have selenium-webdriver specified in your Gemfile currently if it's just being loaded as a dependency of watir or some other library.)
(如果它只是作为watir或其他库的依赖项加载,你当前可能没有在你的Gemfile中指定selenium-webdriver。)
The long term fix, of course, is to move off of PhantomJS to Chrome or Firefox headless.
当然,长期解决方案是将PhantomJS移至Chrome或Firefox无头。