Protractor : How to wait for page complete after click a button?

后端 未结 9 796
抹茶落季
抹茶落季 2020-11-29 00:16

In a test spec, I need to click a button on a web page, and wait for the new page completely loaded.

emailEl.sendKeys(\'jack\');
passwordEl.sendKeys(\'123pwd         


        
9条回答
  •  广开言路
    2020-11-29 00:47

    In this case, you can used:

    Page Object:

        waitForURLContain(urlExpected: string, timeout: number) {
            try {
                const condition = browser.ExpectedConditions;
                browser.wait(condition.urlContains(urlExpected), timeout);
            } catch (e) {
                console.error('URL not contain text.', e);
            };
        }
    

    Page Test:

    page.waitForURLContain('abc#/efg', 30000);
    

提交回复
热议问题