[英]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.