Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to assert redirections in Selenium?

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.

like image 226
Andrew Avatar asked May 04 '10 21:05

Andrew


People also ask

What are methods we can redirect URL in selenium?

The respective command that takes you forward by one page on the browser's history can be written as: driver. navigate(). forward();

What is waitFor assertion in selenium?

A “waitFor” command waits for some condition to become true. They will fail and halt the test if the condition does not become true within the current timeout setting. Perhaps, they will succeed immediately if the condition is already true.

What is selenium AssertionError?

AssertFalse method asserts that a specified condition is false. It throws an AssertionError if the condition passed to assert false method is not satisfied. AssertEquals, AssertTrue, and AssertFalse methods are the most commonly used assertions in Selenium.


1 Answers

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

$this->assertLocationEquals($someNewUrl);
like image 55
s_hewitt Avatar answered Sep 18 '22 00:09

s_hewitt