jarib / celerity

This project is no longer maintained.
http://celerity.rubyforge.org/
GNU General Public License v2.0
206 stars 38 forks source link

How to get intermediates pages during redirection 302 #54

Open falaise opened 13 years ago

falaise commented 13 years ago

Hi,

For instance, I have something like :

br= Celerity::Browser.new

br.goto foo

and br.url gives bar because foo redirect to bar. I wish to parse also the body of page foo.

If i set a listener on :web_window_event I receive something like :

WebWindowEvent(source=[TopLevelWindow[name=""]] type=[CHANGE] oldPage=[null] newPage[HtmlPage(bar)@920503681]

Regards

matthewbretherton commented 12 years ago

I saw a posting where the whole redirect chain is visible in HTMLUnit but cucumber specification flowed well by simply breaking the HTML Unit auto redirect processing by

@browser.webclient.setRedirectEnabled(false) where @browser in my Celerity browser

This makes examining the content of the redirect possible and response code

A convenient implementation in cucumber is to put it under its own tag and reduce load in the test steps

Before('@disable-auto-redirect') do @browser.webclient.setRedirectEnabled(false) end

Hope this helps

Matthew