How can I wait for a condition?

前端 未结 8 752
礼貌的吻别
礼貌的吻别 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:08

    Protractor 1.7.0 has also introduced a new feature: Expected Conditions.

    There are several predefined conditions to explicitly wait for. In case you want to wait for an element to become present:

    var EC = protractor.ExpectedConditions;
    
    var e = element(by.id('xyz'));
    browser.wait(EC.presenceOf(e), 10000);
    
    expect(e.isPresent()).toBeTruthy();
    

    See also:

    • Expected conditions in protractor

提交回复
热议问题