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

前端 未结 4 1553
耶瑟儿~
耶瑟儿~ 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:24

    Figured this out. I simply added the code below, after the click method:

    describe('Search', function() {
       it('should click Search button and wait for results', function() {
            browser.driver.findElement(by.id('search')).click();
            dvr.wait(function() {
                return dvr.isElementPresent(by.xpath(
                    '/html/body/div/div[4]/div/div[2]/div/div/div/span'));
            }, 20000);
        });
    });
    

提交回复
热议问题