In the page I'm testing, two buttons may be displayed: BASIC or ADVANCED.
I want to be able to tell if the ADVANCED button is showing -- and if so, click it.
If the BASIC button is showing, I want to do nothing and continue with my test.
All of the Nightwatchjs options I've experimented with generate a failure message. For example if I "waitforpresent" or "waitforvisible" and the button is not there, it generates an error/failure. I just want to know which button is present so I can make a decision in my code.
Here is what I have tried:
try {
browser.isVisible('#advanced-search', function(result) {console.log(result.state); })
} catch (myError)
{
console.log(myError);
}
Thoughts?
Nightwatchjs
to determine the visibility of the element? You generally do not expect the test to look for some element that may not present(for the sake of performance at least). I would, in that case, see if the element exists or not and do otherwise(possibly try/catch) as well – Mysia