Watir: password field unfindable in Safari
I'm brand new to Watir. I'm using SafariWatir on a fully updated MBP Snow Leopard.
So far I've successfully used
开发者_StackOverflow社区goto, link, text_field, and button
but when I try to access a text_field with
type="password" name="pass" id="pass"
(as seen in Web Inspector) with
browser.text_field(:id, "pass") or
browser.text_field(:name, "pass")
I get
Watir::Exception::UnknownObjectException: Unable to locate TextField
There's a very simple answer:
In Watir and FireWatir, a password field is called
text_field
In SafariWatir, a password field is called
password
So, to access a input of type=password, I needed to use
browser.password(:id, "pass")
or
browser.password(:name, "pass")
This solved my problem.
Notes: I'm using mac 10.8,ruby 1.9.3;
The working sample is: browser.password(:name,'password').set'yourpassword'
There is no space between set
and the value.
精彩评论