Watir-webdriver:网站上的Chrome未处理错误,IE和Firefox工作正常

时间:2011-08-31 16:44:05

标签: ruby google-chrome watir watir-webdriver

所以我认为这可能是ChromeDriver的错误,但是想先问一下。

我在使用Chrome时几乎每个webdriver函数都遇到了麻烦,但IE和Firefox工作正常。

该网站是www.bing.com用Windows实时网站登录的。

https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=1314808262&rver=6.0.5286.0&wp=MBI&wreply=http:%2F%2Fwww.bing.com%2FPassport.aspx%3Frequrl%3Dhttp%253a%252f%252fwww.bing.com%252f&lc=1033&id=264960

在使用chrome时,在该网站上,我可以正常使用的两个功能是

@browser.title
@browser.html 

是唯一可正常工作的功能。当我尝试

@browser.links.size
@browser.button[0].flash
@browser.button[0].click 

我得到了

Selenium :: WebDriver :: Error :: UnhandledError:

使用:id等引用对象也不起作用。

但IE和Firefox可以很好地与网站互动。

如果您需要代码或说明,请告诉我,但基本上我无法让chrome与该站点中的日志进行交互。 (其他网站在Chrome上工作得很好)

1 个答案:

答案 0 :(得分:0)

您需要安装ChomeDriver,它涉及下载二进制文件并将其放在PATH上。请参阅:http://watirwebdriver.com/chrome/

此网站在Chrome中非常适合我。

例如

$irb
ruby-1.9.2-p290 :001 > require 'watir-webdriver'
 => true 
ruby-1.9.2-p290 :002 > b = Watir::Browser.new :chrome
 => #<Watir::Browser:0x6c6e06ba1a564e50 url="about:blank" title="about:blank"> 
ruby-1.9.2-p290 :003 > b.goto "https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=1314808262&rver=6.0.5286.0&wp=MBI&wreply=http:%2F%2Fwww.bing.com%2FPassport.aspx%3Frequrl%3Dhttp%253a%252f%252fwww.bing.com%252f&lc=1033&id=264960"
 => "https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=1314808262&rver=6.0.5286.0&wp=MBI&wreply=http:%2F%2Fwww.bing.com%2FPassport.aspx%3Frequrl%3Dhttp%253a%252f%252fwww.bing.com%252f&lc=1033&id=264960" 
ruby-1.9.2-p290 :004 > b.title
 => "Welcome to Windows Live" 
ruby-1.9.2-p290 :005 > b.html
 => "<!-- ServerInfo: BAYIDSLGN1M37 2011.07.22.19.28.58...