Watir Webdriver(0.9.1) No Longer Opens an Instance of Firefox

烂漫一生 提交于 2019-12-02 04:56:23

问题


While using Watir Webdriver v0.9.1 for rails (along with Selenium Webdriver 2.53.1), Firefox was opening when

  browser = Watir::Browser.new :firefox

was called. Now however, it fails on that line with

unable to bind to locking port 7054 within 45 seconds
    @ /Users/andmcadams/.rvm/gems/ruby-2.0.0-p648/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/common/socket_lock.rb:59:in `lock'
      /Users/andmcadams/.rvm/gems/ruby-2.0.0-p648/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/common/socket_lock.rb:40:in `locked'
      /Users/andmcadams/.rvm/gems/ruby-2.0.0-p648/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/firefox/launcher.rb:51:in `launch'
      /Users/andmcadams/.rvm/gems/ruby-2.0.0-p648/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/firefox/bridge.rb:43:in `initialize'
      /Users/andmcadams/.rvm/gems/ruby-2.0.0-p648/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/common/driver.rb:53:in `new'
      /Users/andmcadams/.rvm/gems/ruby-2.0.0-p648/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/common/driver.rb:53:in `for'
      /Users/andmcadams/.rvm/gems/ruby-2.0.0-p648/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver.rb:84:in `for'
      /Users/andmcadams/.rvm/gems/ruby-2.0.0-p648/gems/watir-webdriver-0.9.1/lib/watir-webdriver/browser.rb:46:in `initialize'
      test/integration/like_fanpage_task_test.rb:40:in `new'
      test/integration/like_fanpage_task_test.rb:40:in `block (2 levels) in <class:LikeFanpageTaskTest>'

It seemed to do so randomly, as I did not change the code from its working form and that line is the first line called. I have Firefox 37.0.2, which worked earlier. I have tried restarting my computer, killing processes related to ruby and Firefox and starting them again, and reinstalling Firefox but to no avail.


回答1:


Mozilla has introduced a new webdriver, and due to a bug in firefox 47, only the new webdriver works for firefox. However I would suggest permanently switching to the new webdriver either way as support will be fully dropped as of firefox 48.

You can use the new webdriver in ruby using the following:

driver = Selenium::WebDriver.for :firefox, marionette: true

But I don't know if that would make you able to use it in watir as well.

As far as I can tell marionette (the new driver) support is not completed yet in watir (I could be wrong), I see this pull request is dealing with it but it is not completed or merged.

It looks to me as if you can do:

browser = Watir::Browser.new :marionette

When the watir project is finished integrating the new driver.




回答2:


PLease use latest webdriver selenium-webdriver.2.5.4 it is not available yet on seleniumhq but search for it.



来源:https://stackoverflow.com/questions/37800215/watir-webdriver0-9-1-no-longer-opens-an-instance-of-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!