watirbrowser-automationsafariwatir

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

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

Solution

  • 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.