JenO
JenO

Reputation: 11

Nightwatch.js - Element present but not visible

I have an element I'd like to check the content of, however, nightwatch isn't recoginsing it, even though it is visible on the screen.

  browser.waitForElementPresent('mySelector', 20000) //this succeeds
  browser.waitForElementVisible('mySelector', 20000) //this fails
  browser.verify.containsText('mySelector', 'text') //this also fails (of course)

I checked screenshots at fails, and I can definitely see the html element containing the text I'm looking at, and it works with other similar elements I have.

I'm curious to know what nightwatch itself is looking at when checking for visibility, because I cannot see any hidden attributes in the html element either.

Upvotes: 0

Views: 642

Answers (1)

JenO
JenO

Reputation: 11

Problem was with the fact that elements with the same selector stayed in the DOM. Solved by using nth child.

Upvotes: 0

Related Questions