簡體   English   中英

盡管元素存在,Protractor 並未等待頁面加載

[英]Protractor is not waiting for page to load though the element is present

  1. 我正在嘗試使用 sendkeys 在文本框中輸入 otp 但它不起作用。 我也嘗試過使用 browser.waitForAngularEnabled(true) 但沒有運氣。
 element(by.css(".inputOtp > input")).sendKeys('909090');
  1. 通過使用 executescript,它在文本框中輸入文本。

     browser.executeScript("document.querySelector(\".inputOtp > input\").value='909090'");
  2. 現在的問題是它不是單擊同一頁面上存在的繼續按鈕。

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM