In our post on How to automate AngularJS application using protractor we see that browser window is not maximized.
Sometimes we need to maximize our browser window at the time of automation. Protractor has given us a nice command to execute such instruction.
In protractor we write script in our conf.js file using onPrepare function.
The script will be,
In our example we use our project that we develop for one of our previous post.
Step 1 : Open the project and open conf.js file and write the above code in onPrepare function like the following.
Note that onPrepare is a function that fires at the time of executing script. So when browser window opens and it first maximize its browser window and then start navigate to the url.
Step 2 : Now conf.js file look like the following.
Step 3 : Run selenium server and then run the script using the following command.
Note that when browser window opens it first shows a relatively smaller window and then it become maximize to show full screen.
That’s all for now. More new things are coming.
Wish you a happy e2e testing!!!