Watir-webdriver : text.include?("expected text") doesn't work in chrome browser
I use watir-webdriver for testing in Mac OS. As it is all to known that $browser.text.include?("expected text") is used to assert the text in the screen. Currently this m开发者_如何学JAVAethod works fine in Firefox and htmlunit, but will be fail in Chrome browser. Get the following error in the terminal windows.
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'
Any idea of this? or is it a bug?
Thanks!
It's a bug in the Chrome driver with Chrome 14. Downgrade to Chrome 12-13 and you should be fine.
精彩评论