将量角器用于非 Angular 页面时如何等待页面加载或元素出现 [英] How to wait for a page to load or element to be present when using Protractor for a non-Angular page
本文介绍了将量角器用于非 Angular 页面时如何等待页面加载或元素出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 Protractor 的新手.我想我在处理 Angular 页面时遇到了这个问题,但无法弄清楚非 Angular 页面.任何帮助,将不胜感激.
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.
describe('Search', function() {
it('should click Search button and wait for results', function() {
browser.driver.findElement(by.id('search')).click();
});
});
推荐答案
解决了这个问题.我只是在点击方法之后添加了下面的代码:
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);
});
});
这篇关于将量角器用于非 Angular 页面时如何等待页面加载或元素出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文