[英]Protractor is not waiting for page to load though the element is present
element(by.css(".inputOtp > input")).sendKeys('909090');
通过使用 executescript,它在文本框中输入文本。
browser.executeScript("document.querySelector(\".inputOtp > input\").value='909090'");
现在的问题是它不是单击同一页面上存在的继续按钮。
element(by.id('otp-verify-and-continue')).click()
我们在项目中这样写:
// Ensure element is loaded in DOM
browser.wait(EC.presenceOf(element.all(by.className(elementToFind)).first()), 60000);
expect(element.all(by.className(elementToFind)).first().isPresent()).toBe(true, 'the element is not presented at the page after Timeout');
// Find it
el = element.all(by.className(elementToFind)).first();
// Ensure it is displayed and do things
el.isDisplayed();
el.sendKeys(keysToSend);
等待按钮出现的最佳选择是browser.wait()
。 您应该在单击验证和继续按钮之前使用它。 (请等待并检查可见性而不是存在)作为browser.wait(protactorObject.visibilityOf(element(by.id('otp-verify-and-continue'))),60000)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.