A selenium webdriver exception

后端 未结 5 1270
萌比男神i
萌比男神i 2021-02-04 07:17

Today, when i use the selenium webdrive, i got an error. my platform is mac osx . this is my exception log.

ruby-1.9.2-p0 > Selenium::WebDriver.for :firefox
         


        
相关标签:
5条回答
  • 2021-02-04 07:35

    I was getting this as well and running "lsof -i TCP:7054" and killing the offending pid fixed my issue also.

    0 讨论(0)
  • 2021-02-04 07:36

    I've been using cucumber + capybara + webdriver + parallel_tests, & i've encountered the mentioned error. To resolve the issue, i added the following to features/support/env.rb:

    unless (env_no = ENV['TEST_ENV_NUMBER'].to_i).zero?
      # Standard, which is described at the parallel_tests github page
      Capybara.server_port = 8888 + env_no
    
      # This successfully avoids locking port error, may require less, but
      # on my 8 cores vm, this works like a charm
      sleep env_no * 10
    end
    

    U probably need to adapt the above to fit what u use, the idea is just to force a sleep time to avoid starting all firefox instances at abt the same time, where a wait of 45secs may not be enough.

    0 讨论(0)
  • 2021-02-04 07:39

    WebDriver uses port 7054 (the "locking port") as a mutex to ensure that we don't launch two Firefox instances at the same time. Each new instance you create will wait for the mutex before starting the browser, then release it as soon as the browser is open.

    So this could indeed be a resource issue - a previously created driver is taking more than 45 seconds to launch and is holding on to the lock for that time.

    If this seems unlikely in your case it would be interesting to know what process is holding the lock. Try running lsof -i TCP:7054 in the 45 seconds before it times out.

    Running ruby with -d (or setting $DEBUG = true) will also provide some useful info for debugging this further.

    0 讨论(0)
  • 2021-02-04 07:50

    I noticed that it would run on port 7054 but it was looking for it on port 7055.

    bundle update did it for me

    0 讨论(0)
  • 2021-02-04 07:56

    I did lsof -i TCP:7054 and found the corresponding process_id, and then finally killed the given process withkill -9 process_id

    And then tried the test again, and it did worked :)

    0 讨论(0)
提交回复
热议问题