[Wtr-general] This is really close to fixing another access problem I hope Re: [question] access denied OLE error code:80070005
Bret Pettichord
bret at pettichord.com
Tue May 9 12:23:54 EDT 2006
That isn't going to help. Your problem is that you have found a limit to the
COM API to IE. You need to find another workaround in the COM API. Here it
is:
http://windowssdk.msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reflist_vb.asp
The checker code is simply code that runs *after* a page is loaded. There
are many ways to hook code into Watir. But first you need to find the COM
calls that will solve your problem.
Have you been unable to use window clicking to get rid of the password
dialogs? Have you tried the Wet Dialog support?
Bret
On 5/9/06, Chris McMahon <christopher.mcmahon at gmail.com> wrote:
>
> On 5/8/06, Bret Pettichord <bret at pettichord.com> wrote:
> > This might fix your problem depending on the actual code that failed.
> (Show
> > us more of your code if you need more help.)
> >
> > class Watir::IE
> > attr_accessor error_checkers
> > end
> > ie.error_checkers = []
>
>
> I have been struggling mightily to code HTTP Basic Authentication into
> Watir, and failing, but this provides a tantalizing :) hint of an
> approach I haven't tried yet.
>
> Basic Authentication, in a nutshell, is when the server returns a 401
> Authorization Required error to the browser. The browser throws up a
> javascript logon box prompting for username/password. The combination
> user/pass is minimally encoded, and then used for subsequent GETs and
> POSTs in the same domain.
>
> However, a client that already knows the encoded user/pass should be
> able to bypass the logon box by adding the appropriate "Authorization:
> Basic" header to the request for the frame, link, inline image, or
> whatever. So I hacked watir.rb's goto() method like this:
>
> def goto(url)
> #@ie.navigate(url)
> @ie.navigate(url,nil,nil,nil,"Authorization: Basic
> YFoObAr46bG1ubw==\n")
> wait()
> sleep 0.2
> return @down_load_time
> end
>
> This actually works for the main page, which is very cool.
>
> However, now IE produces a logon popup box for the iframe on the
> page. If I dismiss that box, I get the logon popup box when I try to
> follow the link on the page. IE doesn't put the right Authorization
> headers on subsequent requests.
>
> So I tried hacking a proxy to add the headers whenever IE calls out.
> I add the headers, but I'm doing something wrong, because the server
> doesn't recognize them properly, and I still get the popup boxes:
>
> def handler(req, res)
> add_hash = { "authorization" => "Basic YFoObAr6bG1ubw==" }
> p "----------------Request Headers----------------"
> req.header.merge!(add_hash)
> req.header.each { |key,value| puts "#{key} is #{value}" }
> etc...
> end.
>
> So after that long-winded explanation: does anyone think that
> attr_accessor in something like that code
>
> > class Watir::IE
> > attr_accessor error_checkers
> > end
> > ie.error_checkers = []
>
> would be capable of adding Basic Auth headers correctly?
> -Chris
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060509/19d5ee1e/attachment.html
More information about the Wtr-general
mailing list