I am getting exactly the same behavior using this approach as I did hacking the raw string: my browser is authorized only for the outer page.
In my app, frames and links inside the outer page are also protected by basic auth. That is, each of the internal frames and links send back a 401 error to the browser upon first attempting to access them. IE by itself is smart enough to the do the right thing and acknowledge every single 401 it receives from the page, but Watir doesn't work that way-- you only get one goto() method per page, and hacking Watir to acknowledge an arbitrarily large number of 401 challenges seems like a complicated job. Again, I could be wrong, but the code below on my app behaves exactly like my other demonstration code. -Chris On 7/31/06, Danny R. Faught <[EMAIL PROTECTED]> wrote: > > I tried and failed, but I thought my problem was in the way IE handled > the data. I'd love to be proven wrong: > > It works for me, hacking watir.rb with hardcoded credentials like so - > > def goto( url ) > user = "username" > pass = "password" > auth = "Authorization: Basic " + > Base64.encode64(user + ":" + pass) + "\015\012" > @ie.navigate(url, nil, nil, nil, auth) > wait() > sleep 0.2 > return @down_load_time > end > > I added a "require 'base64'" near the top. > > This is working for a site that's a huge mess of nested frames plus a > swarm of small js, image, and css files, etc. I noticed that you > hardcoded the base64 encoding of the credentials. Did you try to do it > by doing the encoding on the fly? > > To productize it, I'd recommending adding a credentials method like > Win32::IE::Mechanize uses. > > -Danny > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
