Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browser Back Button using protractor or javascript

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

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) 

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

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

like image 252
Sakamoto Kazuma Avatar asked May 19 '14 13:05

Sakamoto Kazuma


People also ask

How do I use the browser back button in protractor?

Purpose: The protractor command back() is used to move backward in the browser history. Returns: This command returns a promise that will be resolved when the navigation event has completed.

Does protractor use JavaScript?

Protractor is a NodeJS program which is written in JavaScript and runs with Node to identify the web elements in AngularJS applications, and it also uses WebDriver to control the browser with user actions.


1 Answers

In your protractor test:

browser.navigate().back(); 
like image 57
wcandillon Avatar answered Sep 22 '22 15:09

wcandillon