How to wait for a page to load or element to be present when using Protractor for a non-Angular page

前端 未结 4 1555
耶瑟儿~
耶瑟儿~ 2021-02-09 16:32

I am new to Protractor. I think I have this down when dealing with an Angular page, but can\'t figure it out for a non-Angular page. Any help would be appreciated.



        
4条回答
  •  离开以前
    2021-02-09 17:06

    Another Neat approach is to use "Expected Conditions" inside browser.wait - something like this:

    var EC = protractor.ExpectedConditions;
    var search = element(by.id('search'))
    browser.wait(EC.visibilityOf(search), 2000).then(function(){
     search.click()
    })
    

    You can get more details here: https://angular.github.io/protractor/#/api?view=ExpectedConditions

提交回复
热议问题