1
votes

I have a scenario:

  @javascript
  Scenario: Login as a student 
    Given I am on "/"
    And I wait for 1 seconds
    When I fill in "login-email" with "[email protected]"
    And I fill in "login-pass" with "password"
    And I follow "CONFIRM" 
    And I wait for 1 seconds
    Then I should see "WELCOME Test Student"

It works up until trying to follow the "CONFIRM" link. The link looks like this:

<a id="login-nav-br-submit" class="button nav-button shadow-bottom shade" style="right: 0px;">CONFIRM</a>

Also tried using the id of the <a> element but that also fails. I see its not a <a href="">. Is there a way to get Mink to follow the link?

1

1 Answers

1
votes

If you don't have a href attribute then there is no link. I mean where do you expect it to follow if there is nowhere to go to? If it has a JS attached that does something, then you can literally click on it instead of following it:

/**
 * @When /^(?:|I )click on "(?P<text>.+)" link$/
 */
public function clickOnLink($text)
{
    $element = $this->getSession()->getPage()->find('xpath', '//a[text() = "' . $text . '"]');
    $element->click();
}