使用量角器或 javascript 的浏览器后退按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23739066/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Browser Back Button using protractor or javascript
提问by Sakamoto Kazuma
I am writing an automated test for the browser back button on logout of an angular application using a combination of protractor and cucumberjs.
我正在使用量角器和黄瓜js的组合在注销角度应用程序时为浏览器后退按钮编写自动化测试。
When trying to use the command history.back()
I get the following error:
尝试使用该命令时history.back()
,出现以下错误:
ReferenceError: history is not defined
at World.<anonymous> (/Users/&&&&&/&&&&&/features/step_definitions/browsers.js:62:16)
This points to where I'm calling the history.back(); function.
这指向我调用 history.back(); 的地方。功能。
How do I fix this, or correctly implement a browser back function using cucumber js?
我该如何解决这个问题,或者如何使用 Cucumber js 正确实现浏览器返回功能?
回答by wcandillon
In your protractor test:
在您的量角器测试中:
browser.navigate().back();