开发者

Watir: password field unfindable in Safari

开发者 https://www.devze.com 2023-03-20 04:08 出处:网络
I\'m brand new to Watir.I\'m using SafariWatir on a fully updated MBP Snow Leopard. So far I\'ve successfully used

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消