behat selenium server clicking browser back button without waiting for page inside iframe to load

3.7k Views Asked by At

Here is my function code:

$this->getSession()->switchToIFrame("test-frame");
$page = $this->getSession()->getpage();
$page->fillField("name", "Test user");
$page->selectFieldOption("month", "01");
$page->selectFieldOption("year", $currentdate + 1);
$page->fillField("date", "01");
$page->pressButton("Save");
$this->getSession()->wait(7000);
$page->pressButton("Authenticate");

In my browser page there is iframe which loads a form. Post "Save" it goes to another page having "Authenticate" button. After clicking "Authenticate" button it goes to "Waiting..." page and redirect to browser with completion page. I want to hit browser back button after "Authenticate" but before "waiting..." page get fully loaded. Default behat/mink is loading "waiting..." page and then hit browser back button which I don't want.

Is there any way to tell selenium webdriver to click browser back button without waiting for "waiting..." to get loaded.

2

There are 2 best solutions below

3
On

$this->getSession()->getDriver()

2
On

You can use

driver.navigate().back();

or

driver.navigate().forward();