I'm writing some watir test cases:
browser.goto "http://egauge2592.egaug.es/"
browser.link(:href,"/settings.html").click
browser.text_field(:index,4).set("some text")
browser.button(:id,"save_button").click
then a 'Authentication Required' dialogue opens, asking for username and password .
No matter how I tried, I couldn't access the text fields.
I tried send_keys
and JavaScript.
I also tried Watir.autoit
but it says undefined method.
I'm using watir on a Ubuntu machine with the FireFox browser.
How to fill in username and password fields of that dialogue box? I was able to enter username with browser.alert.set but could only set username couldn't access password field.
I use watir-webdriver instead and this (http://watirwebdriver.com/basic-browser-authentication/) works for me.
Just put your basic auth credentials in the url:
I wrote a firefox plugin to deal with this problem recently. I haven't tried it with headless Firefox, but it might work... worth a try. See the following for details:
http://www.natontesting.com/2012/10/06/firefox-plugin-test-automation-password-manager/
To get it working with watir, try the following: