Is this what it's supposed to look like?
Given /^I am logged into "([^\"]*)" as user="([^\"]*)", password="([^
\"]*)",$/ do |site, user, pwd|
basic_auth(user, pwd)
visit site
#fill_in 'name', :with => user
#fill_in 'pass', :with => pwd
#click_button "Log in"
end
On Nov 17, 6:17 pm, Martin Emde <
martin.e...@gmail.com> wrote:
> This looks like a basic auth challenge with a custom login page. These
> aren't that common. It may be necessary to send basic auth credentials with
> your request rather than logging in using this form. I believe this is
> browser only and that http does not specify this behaviour.
>
> I see a 403 response in every http checker that I use. I'm not sure why your
> firebug is responding otherwise. You can at least get on with your code by
> sending basic auth with this request.
>
> It seems like the web server should be responding with a 401 Unauthorized to
> follow http correctly.
>
> Martin Emde
>
> On Tue, Nov 17, 2009 at 9:17 AM, Larry Siden <
lsi...@gmail.com> wrote:
> > I'm using Mechanize.
>
> > The site ishttp://
gator1087.hostgator.com/~tes/admin/.
>
> > Curiously, when I run these commands from a cucumber step,
>
> > puts "site=#{site}"
> > visit site
>
> > The output is:
> > site=
http://gator1087.hostgator.com/~tes/admin/
> > ...
> > 403 => Net::HTTPForbidden (WWW::Mechanize::ResponseCodeError)
> > ...
>
> > But if I load the page in Firefox with Firebug enabled, the Net panel shows
> > that the response was 200.
>
> > Then, from the command line:
>
> > $ wgethttp://
gator1087.hostgator.com/~tes/admin/
> > 2009-11-17 12:07:22 ERROR *403*: Forbidden.
>
> > So I'm a bit confused. wget and Webrat::Mechanize both report 403, but
> > Firebug report 200 and Firefox displays the page with a login form. I
> > thought there might be some redirection at work here, but 403's don't come
> > with a redirect header (HTTP 403 - Wikipedia, the free encyclopedia<
http://en.wikipedia.org/wiki/HTTP_403>), and Webrat is supposed to follow all redirects in any case:
> >
http://blog.andrew.premdas.org/articles/2008/10/15/webrat-visits-and-...