Javascript 尽管元素存在,量角器并没有等待页面加载 我试图使用sendkeys在文本框中输入otp,但它不起作用。我也尝试过使用browser.waitForAngularEnabled(true),但运气不好
通过使用executescript,它在文本框中输入文本Javascript 尽管元素存在,量角器并没有等待页面加载 我试图使用sendkeys在文本框中输入otp,但它不起作用。我也尝试过使用browser.waitForAngularEnabled(true),但运气不好,javascript,angular,protractor,Javascript,Angular,Protractor,通过使用executescript,它在文本框中输入文本 browser.executeScript("document.querySelector(\".inputOtp > input\").value='909090'"); 现在的问题是,它不是点击继续按钮,这是在同一页上 元素(按.id('otp-verify-and-continue')。单击() 我们在项目中写道: // Ensure element is loaded in DO
browser.executeScript("document.querySelector(\".inputOtp > input\").value='909090'");
元素(按.id('otp-verify-and-continue')。单击()
我们在项目中写道:
// 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);
我们在项目中写道:
// 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(protactobject.visibilityOf(element)(by.id('otp-verify-and-continue')),60000)
等待按钮出现的最佳选项是browser.wait()。您应该在单击“验证并继续”按钮之前使用它。(请等待并检查是否可见,而不是是否存在
browser.wait(protectorbject.visibilityOf(element)(by.id('otp-verify-and-continue')),60000)
您可能需要创建并发送鼠标事件。如果在firefox的检查器中打开。您可以查看绑定到该按钮元素的事件。您可能需要创建并发送鼠标事件。如果在firefox的检查器中打开。您可以看到绑定到该按钮元素的事件。