[Wtr-general] hacked goto() almost working, any ideas? Re: anyone ever hacked Watir to do Basic Authentication?

Cain, Mark Mark_Cain at rl.gov
Thu May 4 09:57:18 EDT 2006


The guy in your linked article is trying to automate Mozilla using the
IE Object.  That is probably most of His problem since they use
completely different DOMs.

Did you try adjusting your IE security settings?  In IE select Tools >>
Internet Options.  Click the Security tab.  Click the Custom Level
button and scroll to the very bottom of the setting dialog.  The User
Authentication section gives you some IE options for logging in.  If you
choose the second option, make sure your site is listed in the 'Intranet
Zone'.

--Mark


-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Chris McMahon
Sent: Wednesday, May 03, 2006 3:24 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] hacked goto() almost working,any ideas? Re:
anyone ever hacked Watir to do Basic Authentication?

Finally, seems like my problem is just for frames.  In fact, it seems
exactly like this problem:

http://www.talkaboutsoftware.com/group/microsoft.public.inetsdk.programm
ing.webbrowser_ctl/messages/17461.html

I've also tried navigating directly to the frame in question first,
then to the main page, but it doesn't help, the browser still won't
use auth credentials to request the frame.


On 5/3/06, Chris McMahon <christopher.mcmahon at gmail.com> wrote:
> Check this out, I've hacked watir's goto() method:
>
> 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 auth popups for inline images and things.
>
> 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.
>   Anyone have any ideas about how to make that happen through hacking
> on Watir directly?
>
> -Chris
>
>
> On 5/3/06, Chris McMahon <christopher.mcmahon at gmail.com> wrote:
> > So using net/http, I can do:
> >
> > my_id  = 'user'
> > my_pwd = 'password'
> > auth   = "Basic " + Base64.encode64( "#{my_id}:#{my_pwd}" )
> >
> > url    = '/'
> > site   = 'server'
> > port   = 80
> >
> > req = Net::HTTP.new( site, port )
> > req.get( url, 'Authorization' => auth ) do |r|
> >  puts r
> > end
> >
> > Has anyone ever considered having Watir do
> >
> > my_id  = 'user'
> > my_pwd = 'password'
> > auth   = "Basic " + Base64.encode64( "#{my_id}:#{my_pwd}" )
> >
> > ie = IE.new
> >     ie.goto("http://server").auth
> >
> > It seems like it ought to be possible, and it'd save 99% of the
> > WinClicker ugliness.
> >
> > -Chris
> >
>

_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general




More information about the Wtr-general mailing list