[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

help with Internet Explorer +Watir +basic authentication?

Chris McMahon

5/3/2006 8:07:00 PM

Hi...

After googling for lots of Win32OLE goodies, I've hacked the Watir
goto() method to pass Basic Authentication credentials:

def goto(url)
#@ie.navigate(url)
@ie.navigate(url,nil,nil,nil,"Authorization: Basic
AbdXyz46bG1ubw==\n")
wait()
sleep 0.2
return @down_load_time
end

and it works!!

The only problem is that it works only for the very first transaction.
I'm now getting authorization popups for inline images and things on
the very first page.

Under normal circumstances, the browser, having passed basic
authentication credentials once to this site would know to *always*
pass
those credentials to that site for every subsequent GET/POST/whatever.

But that doesn't seem to be the case when I navigate() to the site from
within Watir's goto() method.

Any suggestions for persuading IE-controlled-by-Watir to always pass
auth credentials for every GET/POST would be welcome.

5 Answers

paul.rogers

5/3/2006 8:17:00 PM

0

Chris, I cant get my web email to work, so couldnt reply to your
message on the watir list

Watir has a thing called an error checker, look at the watir source for
the HTTP_Checker ( I think thats what ts called).

The checker gets run on every page load, normally you would use it to
see if something you expect on every page ( like a logo ) is there.

You may be able to write one that appends the auth string to the end of
gets and puts

Paul


Chris McMahon wrote:
> Hi...
>
> After googling for lots of Win32OLE goodies, I've hacked the Watir
> goto() method to pass Basic Authentication credentials:
>
> def goto(url)
> #@ie.navigate(url)
> @ie.navigate(url,nil,nil,nil,"Authorization: Basic
> AbdXyz46bG1ubw==\n")
> wait()
> sleep 0.2
> return @down_load_time
> end
>
> and it works!!
>
> The only problem is that it works only for the very first transaction.
> I'm now getting authorization popups for inline images and things on
> the very first page.
>
> Under normal circumstances, the browser, having passed basic
> authentication credentials once to this site would know to *always*
> pass
> those credentials to that site for every subsequent GET/POST/whatever.
>
> But that doesn't seem to be the case when I navigate() to the site from
> within Watir's goto() method.
>
> Any suggestions for persuading IE-controlled-by-Watir to always pass
> auth credentials for every GET/POST would be welcome.

Chris McMahon

5/3/2006 8:51:00 PM

0

Turns out it's the frames that are not being retrieved with the auth
headers. I have exactly the problem described here, I think:

http://www.talkaboutsoftware.com/group/microsoft.public.inetsdk.programming.webbrowser_ctl/messages/...

(Alex Furman)

5/4/2006 8:36:00 PM

0

Have you seen SW Explorer Automation (http:\\webunittesting.com). The
program is easier to use then WATIR. The program handles all IE
windows: popup, windows dialogs (including authentication dialog) and
html dialogs.

Chris McMahon

5/5/2006 3:52:00 PM

0

I would really rather find a way for IE to actually recognize Basic
Authentication headers and react appropriately when invoked from a
script. I've tried a couple of ways, but haven't found how to make it
work when scripting IE.

bpettichord

5/7/2006 10:00:00 PM

0

Alex,

I see you've plugged your program a couple times on this list. Does it
support Ruby?

Bret