Alexandru Olaru
Alexandru Olaru

Reputation: 7112

How to press an <a> link with zombie.js?

I am using behavior driven development with cucumber-js, and trying to write a test to follow a link, and I have the following code:

When I click "Add page"

this.When(/^I click "([^"]*)"$/, function(link, callback) {
  this.browser.pressButton(link, callback);
});

Add page is a link button:

<a href="/surveys"><button>Add page</button></a>

The idea that the zombie rest on the same page after pressing the button, is there an other way ?

Upvotes: 0

Views: 626

Answers (1)

Brijesh Bhakta
Brijesh Bhakta

Reputation: 36

The function pressButton is used to press a button the page. For clicking a link on a page use clickLink function.

So your code should be:

this.When(/^I click "([^"]*)"$/, function(link, callback) { this.browser.clickLink(link, callback); });

Upvotes: 2

Related Questions