Can not use variable in IRB after var = Watir::Browser.start 'url'

北战南征 提交于 2020-01-03 12:02:09

问题


1.9.3-p327 :001 > require 'watir-webdriver'
=> true 
1.9.3-p327 :002 > b = Watir::Browser.new

Then firefox starts and I can do nothing. My IRB does not allow me to enter new commands.

Tried different variations of browser initialization:

b = Watir::Browser.new :opera
b = Watir::Browser.new :firefox
b = Watir::Browser.start 'url'

There should appear something like:

=> #<OperaWatir::Browser:0x1496e57 @active_window=#<OperaWatir::Window:0x1eb1db2
@browser=#<OperaWatir::Browser:0x1496e57 ...>>,@driver=#
Java::ComOperaCoreSystems::OperaDriver:0xeabd2f>>

but there is no output in console. After 60 seconds browser closes and I get the following output:

1.9.3-p327 :002 > b = Watir::Browser.new
Selenium::WebDriver::Error::WebDriverError: unable to obtain stable firefox connection
in 60 seconds (127.0.0.1:7055)

Tried chrome, firefox, browser opens, but irb locks.

OS:Ubuntu

Ruby: 2.0.0 (also tried on 1.9.3)


回答1:


Selenium::WebDriver::Error::WebDriverError unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) - this happened generally when your browser version and web-driver version not matched. I personally observed the same. Only solution is to synchronize watir-webdriver and your browser version as documented in their official site.

Here are some Good resources of the fact:

resource1

resource2

resource3

Hope it will help you out.



来源:https://stackoverflow.com/questions/16035059/can-not-use-variable-in-irb-after-var-watirbrowser-start-url

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