Search code examples
rubyseleniumfirefoxwatir-webdriverheadless

unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) -CentOS


I get the error: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) when I run this code:

require 'watir-webdriver'
require 'headless'

headless = Headless.new
headless.start

begin
    browser = Watir::Browser.start "https://google.com"
rescue Exception => e
    puts e
    puts "Exiting..."
    exit
end

browser.goto "http://google.com"
puts browser.url
browser.close

I am using: I am using Firefox version 38.7.0, Headless gem version 2.2.3 and Selenium-Webdriver gem version 2.53.0.

I have tried:

  • Updating selenium-webdriver
  • Uninstalling headless, selenium and Firefox and reinstalling them.
  • Restarting the server
  • Updating Firefox to 45.0

The same code works fine in other test environments.

Updates:

I have tried running the same code with Chrome as suggested by a poster. I got the error message: unable to connect to chromedriver 127.0.0.1:9515

Just to be sure everything is installed right I just ran the following:

yum install xorg-x11-server-Xvfb

Response:

Package xorg-x11-server-Xvfb-1.15.0-36.el6.centos.x86_64 already installed and latest version
Nothing to do

I also ran:

yum install firefox

Response:

Package firefox-38.7.0-1.el6.centos.x86_64 already installed and latest version
Nothing to do

Solution

  • So it turns out that it was a user rights issue that was causing the problem. I logged in as the root user and was pleasantly surprised to see that the code ran without any errors.