如何加载页面而不在量角器中重新加载它

Jin*_*inu 2 protractor

在使用量角器进行e2e测试时,需要browser.get加载页面.我试过,但是重新加载页面导致缓存清除.获取ERROR为

失败:在缓存中找不到元素 - 也许页面自查找以来已更改

如何加载页面而不在量角器中重新加载?

Lin*_*ham 9

如果您对角度应用程序中的路由提出疑问,那么您可以尝试使用browser.setLocation().

browser.get('http://angular.github.io/protractor/#/tutorial');
browser.setLocation('api');
// You now will be in http://angular.github.io/protractor/#/api without any page reload
Run Code Online (Sandbox Code Playgroud)

参考:Protractor API browser.setLocation