使用量角器或 javascript 的浏览器后退按钮 [英] Browser Back Button using protractor or javascript

查看:24
本文介绍了使用量角器或 javascript 的浏览器后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用量角器和 cucumberjs 的组合在注销 Angular 应用程序时为浏览器后退按钮编写一个自动化测试.

I am writing an automated test for the browser back button on logout of an angular application using a combination of protractor and cucumberjs.

当尝试使用命令 history.back() 我得到以下错误:

When trying to use the command history.back() I get the following error:

 ReferenceError: history is not defined
        at World.<anonymous> (/Users/&&&&&/&&&&&/features/step_definitions/browsers.js:62:16)

这指向我调用 history.back();功能.

This points to where I'm calling the history.back(); function.

如何解决这个问题,或者使用黄瓜js正确实现浏览器返回功能?

How do I fix this, or correctly implement a browser back function using cucumber js?

推荐答案

在你的量角器测试中:

browser.navigate().back();

这篇关于使用量角器或 javascript 的浏览器后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆