Saturday, November 2, 2019

Maximize Browser In Protractor:


We need to maximize the browser to run our automation scripts smoothly.

We can do it using the following code.


browser.driver.manage().window().maximize();

Now where should we keep this code in our automation code?

Solution 1:

We can keep this code in each it block or BeforeEach block.

Solution 2: 
 
 Protractor onPrepare block of configuration.js file.onPrepare block is the best option because we can write this line once and automatically reflects the effect in each test.




So we need to follow the below steps to implement this

Step 1:

We need to keep this lines in protractor config.js file.



 onPrepare: function() {
    browser.driver.manage().window().maximize();
 }



No comments:

Post a Comment