Gayane Kabalyan
Gayane Kabalyan

Reputation: 76

Nightwatch.js click not reflected in UI

I am trying to click an element in Nightwatch:

client
    .waitForElementVisible('.tt-suggestions div:nth-child(4)', 2000)   
    .click('.tt-suggestions div:nth-child(4)', function(clickStatus) {
        console.log(clickStatus);
    });

I check the clickStatus, and it returns 'success' so the click is being fired on the element. However, it does not reflect in the UI. Any suggestions?

Upvotes: 1

Views: 527

Answers (1)

Fredrik Schöld
Fredrik Schöld

Reputation: 1658

I have found that sometimes you need to add a pause in order for the click to be performed in the browser. Therefore try this in your test:

client
.waitForElementVisible('.tt-suggestions div:nth-child(4)', 2000)
.pause(1000)   
.click('.tt-suggestions div:nth-child(4)', function(clickStatus) {
    console.log(clickStatus);
});

Upvotes: 1

Related Questions