Protractor timeouts

前端 未结 2 1551
我在风中等你
我在风中等你 2021-02-04 12:00

I\'ve been developing automated tests in Protractor for quite some time and like many of you, I\'ve run into gaps which can only be crossed with the browser.sleep()

2条回答
  •  闹比i
    闹比i (楼主)
    2021-02-04 12:42

    This is the way if you want to perform any action when element present or want to wait until it present on page.

        element(by.id).isPresent().then(function(result) {
                if (result) {
                    nextButton.click();
                }
                else{
                    browser.wait(function () {
                        return browser.isElementPresent(element(by.id));
                    },50000);
                }
            }).then(function () {
                nextButton.click();
            });
    
        },
    

提交回复
热议问题