How to wait in protractor till the element is enabled

前端 未结 1 1168
眼角桃花
眼角桃花 2021-02-20 05:41

Protractor is failing when trying to click a button. Initially the button will be in disabled status (after sometime it will be enabled) and protractor thinks that the button is

1条回答
  •  悲哀的现实
    2021-02-20 06:03

    There is a very much suitable Expected Condition - elementToBeClickable - it would wait for an element to be both visible and enabled:

    var elm = element(by.id('paynow-info-btn'));
    var EC = protractor.ExpectedConditions;
    
    browser.wait(EC.elementToBeClickable(elm), 5000);
    elm.click();
    

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