#125 awaiting-patch
Amos King

redirect? not defined on selenium response

Reported by Amos King | January 14th, 2009 @ 11:32 AM | in 0.5

Here is the stack trace from test "should not follow external redirects" do

visit external_redirect_path
assert response.redirect?


test_should_not_follow_external_redirects(WebratTest): NoMethodError: undefined method redirect?' for #<Webrat::SeleniumResponse:0x25701a0>

./test/selenium/webrat_test.rb:24:in `test_should_not_follow_external_redirects'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:94:in `run'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/integration.rb:597:in `run'

Comments and changes to this ticket

  • Bryan Helmkamp

    Bryan Helmkamp January 17th, 2009 @ 11:09 AM

    I'm not sure if it's possible for Webrat to be able to tell if Selenium followed a redirect.

    I suppose we could add a method which returns false all the time if it's not.


  • Amos King

    Amos King January 17th, 2009 @ 12:17 PM

    Isn't there a way to get the response code off of selenium? Or is it too late by the time we redirect. I'll do some research on this. I don't think that false works because it will just blow up asserts.

    Gaffo, any ideas?

  • Bryan Helmkamp

    Bryan Helmkamp January 17th, 2009 @ 02:43 PM

    Amos -- There might be, but what response code would we want if a redirect (302) sends the browser to a 200?

  • Amos King

    Amos King January 17th, 2009 @ 10:51 PM

    How about we just set a flag, and then we use that flag to tell that we were redirected, and as soon as we leave the page we were redirected to it resets the flag to false.

  • Bryan Helmkamp

    Bryan Helmkamp February 8th, 2009 @ 11:43 PM

    • Tag set to featurerequest
    • State changed from “new” to “open”

    I'm not sure if Selenium provides us easy access to this data.

    Assuming it does, it seems the most complete thing to do would be to track the full "redirect history" of a Webrat action that results in a final page loading. This could be a common API for both Selenium and non-Selenium interaction.


  • Amos King

    Amos King February 9th, 2009 @ 07:04 AM

    That sounds like a good idea, and then #redirect? could just check the redirect list. I think it's a god solution.

  • gaffo

    gaffo June 14th, 2009 @ 11:34 PM

    • State changed from “open” to “awaiting-patch”
    • Milestone set to 0.5

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket