I'm new on Watir-webdriver. I have tried running watir-webdriver using Firefox on http://bit.ly/watir-example
I tried on Internet Exploerer (IE ver 8), but it doesn't work. I also have set protected value on IE with the same value. My code is simple as this:
browser = Watir::Browser.new :ie
browser.goto 'http://bit.ly/watir-example'
sleep 5
browser.text_field(:name => 'entry.0.single').set 'My Name'
The error message that I get is like this:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriv开发者_Python百科er-2.6.0/lib/selenium/webdriver/remote/response.rb:45:in `assert_ok': Unable to find element with xpath == .//input[(not(@type) or (@type!="file" and @type!="radio" and @type!="checkbox" and @type!="submit" and @type!="reset" and @type!="image" and @type!="button" and @type!="hidden" and @type!="datetime" and @type!="date" and @type!="month" and @type!="week" and @type!="time" and @type!="datetime-local" and @type!="range" and @type!="color")) and @name='entry.0.single'] | .//textarea[@name='entry.0.single'] (Selenium::WebDriver::Error::UnexpectedJavascriptError)
Can anyone help me please? Thank you.
Use irb
to provide you with some more information about your problem
eg.
> irb
> require 'watir-webdriver'
> browser = Watir::Browser.new :ie
> browser.goto 'http://bit.ly/watir-example'
> puts browser.title
> puts browser.text_fields.count
> browser.text_field.set 'hello'
精彩评论