本文介紹了使用量角器或 javascript 的瀏覽器后退按鈕的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我正在使用量角器和 cucumberjs 的組合在注銷 Angular 應(yīng)用程序時(shí)為瀏覽器后退按鈕編寫一個(gè)自動(dòng)化測(cè)試.
I am writing an automated test for the browser back button on logout of an angular application using a combination of protractor and cucumberjs.
當(dāng)嘗試使用命令 history.back()
我得到以下錯(cuò)誤:
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)
這指向我調(diào)用 history.back();功能.
This points to where I'm calling the history.back(); function.
如何解決這個(gè)問題,或者使用黃瓜js正確實(shí)現(xiàn)瀏覽器返回功能?
How do I fix this, or correctly implement a browser back function using cucumber js?
推薦答案
在你的量角器測(cè)試中:
browser.navigate().back();
這篇關(guān)于使用量角器或 javascript 的瀏覽器后退按鈕的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!