Friday, 17 March 2017

Webdriver.waitUntil doesn't work as expected

I'm using wedriverio 4.5:

./node_modules/.bin/wdio -v
v4.5.2

I need to wait until some element exists and if it doesn't exist handle this situation.

for example:

let element = browser.element('.unexisting');
browser.waitUntil(element.isExisting(), 1000, 'Element is not found.');

But if element doesn't exist on the page, webdriver marks my test as failed and shows message: 'Timeout of 10000ms exceeded. Try to reduce the run time or increase your timeout for test specs (http://webdriver.io/guide/testrunner/timeouts.html); if returning a Promise, ensure it resolves.'

  1. How can I handle this situation? 1.1 I tried try-catch block, but anyway I see same message about timeout and failed test. 1.2 I tried to use:

    browser.on('error', function(e) {
        console.log ('handle browser error');
    })
    
    

    but it doesn't help 1.3 I tried element.waitForExist() but behavior is the same

  2. Why don't I see my message 'Element is not found.'?

Thanks!



via Ivan Levantsov

No comments:

Post a Comment