How can I wait for a condition?

前端 未结 8 722
礼貌的吻别
礼貌的吻别 2020-12-07 15:39

I\'m new on protractor, and I\'m trying to implement an e2e test. I don\'t know if this is the right way to do this, but... The page that I want to test is not a full angula

相关标签:
8条回答
  • 2020-12-07 16:26
    browser.driver.wait(function() {
        return browser.driver.isElementPresent(by.xpath("//a[@href='#/contacts']"));
    });
    

    This works for me too (without the timeout param)..

    for more information, see http://angular.github.io/protractor/#/api?view=webdriver.WebDriver.prototype.wait

    0 讨论(0)
  • 2020-12-07 16:29

    I finally find out...

       var waitLoading = by.css('#loading.loader-state-hidden');
    
       browser.wait(function() {
           return ptor.isElementPresent(waitLoading);
       }, 8000);
    
       expect(ptor.isElementPresent(waitLoading)).toBeTruthy();
    
       var openContact = by.xpath("//a[@href='#/contacts']");
       element(openContact).click();
    

    With this protractor could wait for that element until it loading page disappears. Thanks for those who tried to help XD.

    0 讨论(0)
提交回复
热议问题