SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
346 stars 194 forks source link

Unable to start browser using selenium-webdriver Ruby gem #1152

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 1152

Complete environment:
Win7 x64
Ruby 1.9.2
selenium-webdriver (0.1.2)

Steps to Reproduce is run of script from example:

require "selenium-webdriver"
driver = Selenium::WebDriver.for :ie #or ":firefox" or ":chrome"
driver.navigate.to "http://google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"
element.submit
puts driver.title
driver.quit"

I got following output:
for IE 8:
1. It doesn't starts after running script
2. After 30 seconds stack trace falls:
"       C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/ie/bridge.rb:24:in
`initialize': unable to connect to IE server within 30 seconds (RuntimeError)
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/driver.rb:31:in
`new'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/driver.rb:31:in
`for'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver.rb:73:in
`for'
    from D:/My Dropbox/personal activity/work/automation/SigmaSure/Genealogy/GenealogyForms/features/support/example2.rb:3:in
`<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'
"

For Firefox 3.6:
1. It starts with empty address-bar
2. Afteк 60 secs stack trace falls:
"
C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/firefox/launcher.rb:81:in
`connect_until_stable': unable to obtain stable firefox connection in 60 seconds (Selenium::WebDriver::Error::WebDriverError)
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/firefox/launcher.rb:37:in
`block in launch'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/firefox/socket_lock.rb:32:in
`locked'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/firefox/launcher.rb:32:in
`launch'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/firefox/bridge.rb:21:in
`initialize'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/driver.rb:27:in
`new'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/driver.rb:27:in
`for'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver.rb:73:in
`for'
    from D:/My Dropbox/personal activity/work/automation/SigmaSure/Genealogy/GenealogyForms/features/support/example2.rb:3:in
`<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'
"

Browsers are placed into default locations and have default settings.

Reported by the.zonkers on 2010-12-29 11:33:02

lukeis commented 8 years ago
Could you set $DEBUG = true (or launch ruby with -d) and paste the full output? Is your
Ruby build 64-bit?

Reported by jari.bakken on 2010-12-29 17:44:06

lukeis commented 8 years ago
For Firefox, please also paste the log from Firefox' Error Console.

Reported by jari.bakken on 2010-12-29 17:44:49

lukeis commented 8 years ago
Ruby Debug Output for IE:

Ruby debug output for Firefox:
D:\My Dropbox\personal activity\work\automation\SigmaSure\Genealogy\GenealogyFor
ms\features\support>ruby -d example2.rb
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such fil
e to load -- selenium-webdriver
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such fil
e to load -- rubygems/defaults/ruby
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such fil
e to load -- rubygems/defaults/ruby
Exception `NameError' at C:/Ruby192/lib/ruby/1.9.1/syck/tag.rb:81 - method `yaml
_as' not defined in Module
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- yajl/json_gem
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to
load -- yajl/json_gem
Using c extension for JSON.
Exception `Errno::ENOENT' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-0.6.3-x86-mingw32/lib/ffi/types.rb:171
- No such file or dir
ectory - C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-0.6.3-x86-mingw32/lib/ffi/types.conf
Exception `SocketError' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/socket_poll
er.rb:45 - getaddrinfo: A non-recoverable error occurred during a database lookup.
["localhost", 5555]

#repeation previos errr about 50 times...........

Exception `RuntimeError' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/ie/bridge.rb:24
-
 unable to connect to IE server within 30 seconds
C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/ie/bridge.rb:24:in
`initialize': unable to co
nnect to IE server within 30 seconds (RuntimeError)
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/driver.rb:31:in
`new'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/driver.rb:31:in
`for'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver.rb:73:in
`for'
        from example2.rb:3:in `<main>'

Reported by the.zonkers on 2010-12-30 11:16:43

lukeis commented 8 years ago
AFAIK, standard Ruby one-in-all installer fits well to 32 and 64-bit Win7.
However I have no any problems with other Ruby scripts on my machine.

Reported by the.zonkers on 2010-12-30 11:21:28

lukeis commented 8 years ago
Here is screenshot of firefox Debug console:
http://dl.dropbox.com/u/6413343/firefox_debug_console.png

Thanks for your efforts!

Reported by the.zonkers on 2010-12-30 11:37:09

lukeis commented 8 years ago
this error:

Exception `SocketError' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/socket_poll
er.rb:45 - getaddrinfo: A non-recoverable error occurred during a database lookup.
["localhost", 5555]

Reported by the.zonkers on 2010-12-30 19:48:54

lukeis commented 8 years ago
Does this work on your machine?

ruby -r socket -e 'p Socket.getaddrinfo("localhost", 5555)

Reported by jari.bakken on 2010-12-30 19:50:38

lukeis commented 8 years ago
Sorry, missed a quote. That should read:

ruby -r socket -e 'p Socket.getaddrinfo("localhost", 5555)'

Reported by jari.bakken on 2010-12-30 19:52:47

lukeis commented 8 years ago
Yes, "C:\Users\vdobrovolsky>ruby -r socket -e 'p Socket.getaddrinfo("localhost", 5555)'"
returns :

[["AF_INET6", 5555, "::1", "::1", 23, 0, 0], ["AF_INET", 5555, "127.0.0.1", "127
.0.0.1", 2, 0, 0]]

Reported by the.zonkers on 2010-12-31 11:02:09

lukeis commented 8 years ago
I think this may be caused by the IPv6 address being first in the returned array. That
would explain why it fails for both IE and Firefox as well. 

Can you try the gem from here and report back if it fixes the problem?

http://xserve.openqa.org:8085/browse/S2RB-GEM-JOB1-38/artifact/Rubygem/selenium-webdriver-0.1.3.dev.gem

Reported by jari.bakken on 2011-01-01 23:05:36

lukeis commented 8 years ago
Hi. I tried new selenium-webdriver gem and got new Error StackTraces.

For FF:

C:\Ruby192\bin\ruby.exe -d -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)
"D:/My Dropbox/personal activity/work/automation/SigmaSure/Genealogy/GenealogyForms/features/support/example2.rb"
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- selenium-webdriver
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- rubygems/defaults/ruby
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to
load -- rubygems/defaults/ruby
Exception `NameError' at C:/Ruby192/lib/ruby/1.9.1/syck/tag.rb:81 - method `yaml_as'
not defined in Module
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- yajl/json_gem
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to
load -- yajl/json_gem
Using c extension for JSON.
C:/Ruby192/lib/ruby/1.9.1/rexml/doctype.rb:255: warning: `+' after local variable is
interpreted as binary operator
C:/Ruby192/lib/ruby/1.9.1/rexml/doctype.rb:255: warning: even though it seems like
unary operator
Exception `SocketError' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/platform.rb:131
- getaddrinfo: A non-recoverable error occurred during a database lookup. 
#<Selenium::WebDriver::Firefox::SocketLock:0x36c65a0>: getaddrinfo: A non-recoverable
error occurred during a database lookup. 

          ####<repeat previous Socket error ~50 times>####

C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/firefox/socket_lock.rb:57:
warning: instance variable @server not initialized
Exception `Selenium::WebDriver::Error::WebDriverError' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/firefox/socket_lock.rb:38
- unable to bind to locking port 7054 within 45 seconds
Exception `Selenium::WebDriver::Error::WebDriverError' at -e:1 - unable to bind to
locking port 7054 within 45 seconds
C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/firefox/socket_lock.rb:38:in
`lock': unable to bind to locking port 7054 within 45 seconds (Selenium::WebDriver::Error::WebDriverError)
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/firefox/socket_lock.rb:19:in
`locked'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/firefox/launcher.rb:32:in
`launch'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/firefox/bridge.rb:21:in
`initialize'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/driver.rb:27:in
`new'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/driver.rb:27:in
`for'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver.rb:73:in
`for'
    from D:/My Dropbox/personal activity/work/automation/SigmaSure/Genealogy/GenealogyForms/features/support/example2.rb:3:in
`<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

For IE:

C:\Ruby192\bin\ruby.exe -d -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)
"D:/My Dropbox/personal activity/work/automation/SigmaSure/Genealogy/GenealogyForms/features/support/example2.rb"
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- selenium-webdriver
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- rubygems/defaults/ruby
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to
load -- rubygems/defaults/ruby
Exception `NameError' at C:/Ruby192/lib/ruby/1.9.1/syck/tag.rb:81 - method `yaml_as'
not defined in Module
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- yajl/json_gem
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to
load -- yajl/json_gem
Using c extension for JSON.
Exception `Errno::ENOENT' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-0.6.3-x86-mingw32/lib/ffi/types.rb:171
- No such file or directory - C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-0.6.3-x86-mingw32/lib/ffi/types.conf
Exception `SocketError' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/platform.rb:131
- getaddrinfo: A non-recoverable error occurred during a database lookup. 
Exception `SocketError' at <internal:lib/rubygems/custom_require>:29 - getaddrinfo:
A non-recoverable error occurred during a database lookup. 
Exception `SocketError' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/driver.rb:31
- getaddrinfo: A non-recoverable error occurred during a database lookup. 
Exception `SocketError' at -e:1 - getaddrinfo: A non-recoverable error occurred during
a database lookup. 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/platform.rb:131:in
`getaddrinfo': getaddrinfo: A non-recoverable error occurred during a database lookup.
 (SocketError)
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/platform.rb:131:in
`localhost'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/ie/bridge.rb:11:in
`<class:Bridge>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/ie/bridge.rb:9:in
`<module:IE>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/ie/bridge.rb:3:in
`<module:WebDriver>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/ie/bridge.rb:2:in
`<module:Selenium>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/ie/bridge.rb:1:in
`<top (required)>'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/ie.rb:19:in
`<top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/driver.rb:31:in
`for'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver.rb:73:in
`for'
    from D:/My Dropbox/personal activity/work/automation/SigmaSure/Genealogy/GenealogyForms/features/support/example2.rb:3:in
`<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

For Chrome:

C:\Ruby192\bin\ruby.exe -d -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)
"D:/My Dropbox/personal activity/work/automation/SigmaSure/Genealogy/GenealogyForms/features/support/example2.rb"
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- selenium-webdriver
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- rubygems/defaults/ruby
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to
load -- rubygems/defaults/ruby
Exception `NameError' at C:/Ruby192/lib/ruby/1.9.1/syck/tag.rb:81 - method `yaml_as'
not defined in Module
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to
load -- yajl/json_gem
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to
load -- yajl/json_gem
Using c extension for JSON.
Exception `SocketError' at C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/platform.rb:131
- getaddrinfo: A non-recoverable error occurred during a database lookup. 
Exception `SocketError' at -e:1 - getaddrinfo: A non-recoverable error occurred during
a database lookup. 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/platform.rb:131:in
`getaddrinfo': getaddrinfo: A non-recoverable error occurred during a database lookup.
 (SocketError)
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/platform.rb:131:in
`localhost'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/chrome/command_executor.rb:49:in
`uri'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/chrome/bridge.rb:15:in
`initialize'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/driver.rb:33:in
`new'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver/common/driver.rb:33:in
`for'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-0.1.3.dev/lib/selenium/webdriver.rb:73:in
`for'
    from D:/My Dropbox/personal activity/work/automation/SigmaSure/Genealogy/GenealogyForms/features/support/example2.rb:3:in
`<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

Reported by the.zonkers on 2011-01-03 11:05:36

lukeis commented 8 years ago
OK. The first thing we'll need to figure out is why you're seeing that error "getaddrinfo:
A non-recoverable error occurred during a database lookup." when Socket.getaddrinfo
is used from WebDriver but not when using it directly on the command line.

My first thought is that it only happens when someone is listening on the interface,
so if you could run this script and report back, that would be great:

require "socket"

server = TCPServer.new("127.0.0.1", 5555) # perhaps also try "localhost" here
begin
  p Socket.getaddrinfo("127.0.0.1", 5555)
ensure
  server.close
end

Reported by jari.bakken on 2011-01-03 15:09:20

lukeis commented 8 years ago
I paste your code into bug.rb 

For "127.0.0.1" I got:

bug.rb:4:in `getaddrinfo': getnameinfo: The requested service provider could not
 be loaded or initialized.  (SocketError)
        from bug.rb:4:in `<main>'

For "localhost":

bug.rb:2:in `initialize': getaddrinfo: A non-recoverable error occurred during a database
lookup.
(SocketError)
        from bug.rb:2:in `new'
        from bug.rb:2:in `<main>'

I observed all TCP connection in TCPViewer and canot find any local connection utilizing
"5555" port.

I forgot to tell you that my machine is inside Windows Domain - can it cause this error?

Regards, Vadim

Reported by the.zonkers on 2011-01-03 15:35:39

lukeis commented 8 years ago
Also, just to be sure, try this:

ruby -e 'p Socket.getaddrinfo "localhost", 80, Socket::AF_INET, Socket::SOCK_STREAM'

Reported by jari.bakken on 2011-01-03 15:38:46

lukeis commented 8 years ago
I got:

C:\Users\vdobrovolsky>ruby -e 'p Socket.getaddrinfo "localhost", 80, Socket::AF_
INET, Socket::SOCK_STREAM'
-e:1:in `<main>': uninitialized constant Object::Socket (NameError)

Reported by the.zonkers on 2011-01-03 15:42:28

lukeis commented 8 years ago
Sorry, here's the correct line: 

ruby -r socket -e 'p Socket.getaddrinfo "localhost", 80, Socket::AF_INET, Socket::SOCK_STREAM'

Reported by jari.bakken on 2011-01-03 15:45:38

lukeis commented 8 years ago
For this I got:

C:\Users\vdobrovolsky>ruby -r socket -e 'p Socket.getaddrinfo "localhost", 80, S
ocket::AF_INET, Socket::SOCK_STREAM'
[["AF_INET", 80, "127.0.0.1", "127.0.0.1", 2, 1, 0]]

Reported by the.zonkers on 2011-01-03 15:51:04

lukeis commented 8 years ago
From the results you got in comment 16, and the fact that several people have reported
the gem as working on basically the same system (Windows 7, 64-bit, Ruby 1.9.2), I
think it's safe to conclude that the problem is in your network configuration/environment
and not in our code. 

Please open a new issue if you have reason to believe otherwise.

Reported by jari.bakken on 2011-01-05 01:20:02

lukeis commented 8 years ago
Jari, you was right.
Reinstall of OS resolved this issue.

Thanks for your efforts!

Reported by the.zonkers on 2011-01-06 15:05:04

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 18:11:49