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

后端 未结 9 771
抹茶落季
抹茶落季 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:53

    I typically just add something to the control flow, i.e.:

    it('should navigate to the logfile page when attempting ' +
       'to access the user login page, after logging in', function() {
      userLoginPage.login(true);
      userLoginPage.get();
      logfilePage.expectLogfilePage();
    });
    

    logfilePage:

    function login() {
      element(by.buttonText('Login')).click();
    
      // Adding this to the control flow will ensure the resulting page is loaded before moving on
      browser.getLocationAbsUrl();
    }
    

提交回复
热议问题