Behat & Mink: Using the Browser History

Mink gives you access to browser history. You can use some already defined methods with session object for using browser history.

You can get the current url and also use several Browser functions like reload, forward or backward.

You can use below methods while creating your own custom step definitions or another way is you can call some pre-defined steps:

// get the current page URL
$session->getCurrentUrl();

// reload the page
$session->reload();

// press browser back button
$session->back();

// press browser forward button
$session->forward();

There are some pre-defined steps to use them, see below example:
 

@javascript
  Scenario: Using the Browser History using Mink
    Given I am on the homepage
    And I go to "/user/login"
    And print current URL
    Then I should see an "input[id='edit-submit'][value='Log in']" element
    And I reload the page
    When I move backward one page
    Then I should see an "a[class='feed-icon']" element
    When I move forward one page
    Then I should see an "input[id='edit-submit'][value='Log in']" element