testplane icon indicating copy to clipboard operation
testplane copied to clipboard

How to make conditional check based on visibility [docs]

Open Taffa opened this issue 6 years ago • 1 comments

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')

Taffa avatar Feb 21 '19 16:02 Taffa

Take a look at isVisible

it('bla bla', async function() {
    const visible = this.browser.isVisible('#x');
    if (!visbile) {
        await this.browser.moveToObject('#Y')
    }
    // ...
});

j0tunn avatar Feb 22 '19 11:02 j0tunn