wait for element present without error


606 просмотра

1 ответ

is there a way to call waitForElementPresent in nightwatch without erroring out if the element is not there?

Right now, if you pass in false as the third parameter, you still see an error. Ideally, I would like a function that waits for an element, and returns if it didn't find the element.

Автор: Louisa Scheinost Источник Размещён: 08.11.2019 10:58

Ответы (1)

1 плюс

you can do it :

  Browser.waitForElementPresent('@element',3000,false, function(result){
    If(result.value === true){
    // test if element present
    // test if element not present

Since the day one, i did this and the problem with this code is nightwatch would count a failed test as a passed test,as you see above code handle both result value.

So i recommend let the nightwatch return error itself, write difference function for difference value.

Автор: Bao Tran Размещён: 08.09.2016 08:18
Вопросы из категории :