How to do Basic Authentication using FireWatir on Ubuntu Linux?

Posted by lotharsmash on Stack Overflow See other posts from Stack Overflow or by lotharsmash
Published on 2010-03-31T20:43:48Z Indexed on 2010/04/01 10:53 UTC
Read the original article Hit count: 461

Filed under:
|

Hi,

I'm trying to use FireWatir (1.6.5) to access a site using Basic Authentication and I've been unable to find a solution that works on Firefox in Linux. Does FireWatir 1.6.5 support Basic Authentication on Linux? I've been searching the web for 2 days and can't get a straight answer anywhere as to how to do this.

The only thread I found that seemed helpful was this one ( http://groups.google.com/group/watir-general/browse_thread/thread/d8ab9a177d282ce4/fc1bf2319fb387d8?lnk=gst&q=basic+authentication#fc1bf2319fb387d8).

Aedorn Varanis says " Angrez's fork had the solution so I'm using that now. Thanks Angrez, works perfectly!", but he doesn't mention what he did to get things working.

Initially I tried to bypass the authentication dialog box by using:

browser.goto('http://admin:[email protected]')

However, this generates a "Confirm" dialog which says:

"You are about to log in to the site "172.20.1.1" with the username "admin"." [Cancel, OK]

This dialog blocks, and the goto call won't return until I click "OK".

Then I tried adding:

browser.startClicker("ok") browser.goto('http://admin:[email protected]')

But this ALSO generates the same "Confirm" dialog.

I tested out the startClicker functionality using the unit test /var/ lib/gems/1.8/gems/firewatir-1.6.5/unittests/html/JavascriptClick.html and it worked fine, which makes me think that using the startClicker method is NOT the correct way to take care of the Confirm dialog.

Anybody else found a way to get Basic Auth to work, or how to click the OK on the confirm dialog? I'm at my wits end...

© Stack Overflow or respective owner

Related posts about watir

Related posts about firewatir