Lan*_*ngo 6 javascript angularjs protractor
我当前的单元测试(量角器+ angularJS项目)因错误而失败UnknownError: unknown error: Element is not clickable at point (525, 1103).我使用调试器在失败之前停止它,并且我认为它会失败的唯一原因是因为按钮不在视口中(你必须向下滚动).
失败的线是
homeLink = ptor.findElement(protractor.By.linkText('Home'));
homeLink.click();
expect(ptor.getCurrentUrl()).toBe(homeUrl);
Run Code Online (Sandbox Code Playgroud)
从https://github.com/angular/protractor/issues/319,他说'...当我使用findElement()时,它会将它们滚动到页面的"顶部".评论同意.
在我的测试homeLink = ptor.findElement(protractor.By.linkText('Home'));中没有导致页面滚动.
我认为应该错了吗?
我该怎么办?
您需要先向下滚动(或最大化浏览器,如果这样可以让您看到要单击的按钮),以便按钮在页面上可见:
var scrollIntoView = function () {
arguments[0].scrollIntoView();
}
browser.executeScript(scrollIntoView, yourwebelement);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7483 次 |
| 最近记录: |