Skip to main content

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

// reload the page

// press browser back button

// press browser forward button

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

  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
Video Tutorial


Elix is a premium wordpress theme for portfolio, freelancer, design agencies and a wide range of other design institutions.