Using behat/mink, I'm testing the "remember me" functionality. Functionally, when the user visits the main page, javascript/ajax code verifies if the user is "remembered". If yes, then the javascripts redirects to another page. My LoginPage is defined with $path = '/login.html' - after the redirect, I will end up on /main.html.

In my context, I use $loginPage->open() - however this throws exception Expected to be on "https://example.com/login.html" but found "https://example.com/main.html" instead. Naturally, this aborts the execution and results in the test failing - yet this is exactly the behaviour I want.

How can I tell behat/mink to not verify URL or ignore URL mismatch?

1 Answer 1


If you check the open() method you will see that the check that fails for you is when is checking the url parameters in verify() method.

If you want to avoid this you can override this method to check only for the response and not the url parameters.

In order to do this you need to extend Page and declare a new method like this:

 public function verify(array $urlParameters){
  • Yes, that does it!
    – Aleks G
    Aug 24, 2016 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.