2
votes

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.

2
Seems like you have FF instance but without visible window. So, close all Firefox instances and check that they doesn't run use ps aux | grep firefox command. If you see other firefox instances then kill them or reboot comp.Maxim
Whenever I try to kill the process using sudo kill -9 PID it still shows up when using ps aux | grep firefox but with a PID two greater than the last time and Watir still won't open Firefox.andmcadams
> While using Watir Webdriver v0.9.1 Your stack trace shows you are running watir-webdriver-0.6.2 Lots have changes have been made since then.titusfortner
Good catch, I was testing it with 0.6.2 to make sure I hadn't accidentally upgraded but forgot to change it back. My post now shows the error with Watir 0.9.1andmcadams
Hmm, default port for Firefox is 7055, so I'm not sure how you get 7054 when the Selenium code does: port += 1 until free? port. Set $DEBUG = true and add a gist with your stdout.titusfortner

2 Answers

5
votes

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.

0
votes

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