testplane
testplane copied to clipboard
How to make conditional check based on visibility [docs]
How to add conditional action for example based on whether given element is visible or not? Tried various ways with promises but getting reference error for browser
e.x. return this.browser .url('/')
// How to check here if element X is visible then moveToObject('#x');
// If X not visible then moveToObject('#Y');
// test continues
.click('#Something')
Take a look at isVisible
it('bla bla', async function() {
const visible = this.browser.isVisible('#x');
if (!visbile) {
await this.browser.moveToObject('#Y')
}
// ...
});