views:

228

answers:

2

I am writing a selenium test and I need to assert that the page is redirected. How should I verify this? What would be the best way?

I am using PHPUnit and the PHPUnit_Extensions_SeleniumTestCase.

+2  A: 

assertLocationEquals - Reports an error if the current location is not equal to the given $location.

$this->assertLocationEquals($someNewUrl);
s_hewitt
cool thanks! I forgot about that page, so thanks for the reminder.
Andrew
A: 

I might also add a

$this->selenium->waitForPageToLoad("30000");

or if you're really paranoid, a

sleep(1);

In between the page's call to redirect and the check to see that the new URL loaded. That should help serve as a buffer in the event of a slightly slower web server response.

Alex C