Watir-webdriver:text.include?(“预期文本”)在chrome浏览器中不起作用

时间:2011-07-06 03:01:43

标签: ruby google-chrome watir selenium-webdriver watir-webdriver

我使用watir-webdriver在Mac OS中进行测试。众所周知,$ browser.text.include?(“expect text”)用于断言屏幕中的文本。 目前这种方法在Firefox和htmlunit中运行良好,但在Chrome浏览器中会失败。在终端窗口中收到以下错误。

Selenium::WebDriver::Error::UnhandledError: 
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/response.rb:45:in `assert_ok'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/http/default.rb:56:in `request'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/bridge.rb:476:in `raw_execute'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/bridge.rb:454:in `execute'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/bridge.rb:348:in `getElementText'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/common/element.rb:97:in `text'
    /Users/Zhong/.rvm/gems/ruby-1.9.2-p180@ruby192/gems/watir-webdriver-0.2.4/lib/watir-webdriver/browser.rb:95:in `text'

有什么想法吗?还是一个bug?

谢谢!

1 个答案:

答案 0 :(得分:2)

这是使用Chrome 14的Chrome驱动程序中的一个错误。降级到Chrome 12-13并且您应该没问题。