我现在有在我的测试规格之一量角器下面的代码:量角器时序问题
.then(function() {
return button.click();
})
.then(function() {
return element(otherButton).isDisplayed();
})
.then(function(otherButtonIsPresent) {
if(otherButtonIsPresent) {
return browser.wait(EC.elementToBeClickable(element(otherButton)), getWaitTime())
.then(function() {
element(otherButton).click();
return element(continueButton).isPresent();
})
}
})
当我使用Chrome使用--debug-brk
和--inspect
标志调试,我能够通过这些检查和恢复像平常一样。当我在没有标志的情况下运行相同的测试时,测试失败并在尝试点击它之前查找otherButton
期间停顿。
我想知道是否这是因为在调试过程中,我设置了断点并等待按钮显示在屏幕上,然后再尝试单击它们。
我需要确保这个元素在页面上可见之前试图点击它,并想知道是否有另一种方式,如果完成此?
谢谢
尝试使用browser.wait()与ExpectedConditions沿着使的webdriver到直到某些特定条件。请参阅http://www.protractortest.org/#/api?view=ProtractorExpectedConditions。 –