Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.7k points)

Is there a way to maximize the chrome browser window using python selenium WebDriver?

Note: I am using Chrome Driver 23.0 Any solution on this would be greatly appreciated!

1 Answer

0 votes
by (62.9k points)

 I will tell you how to maximize a browser window using a web driver. Here is a Selenium script with an explanation.

Script Description: In the below Selenium script shown the maximize of the browser using the testNG framework, steps of the scenario are :

  1. Open the Chrome browser.
  2. Launch the site.
  3. Wait for a few seconds to view the maximize action.
  4. Close the browser.

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class Maximize {

public static void main(String args[]) throws InterruptedException

{ WebDriver driver;

System.setProperty("webdriver.chrome.driver","E://Selenium//Selenium_Jars//chromedriver.exe");

driver= new ChromeDriver();

         // Launch the application

      driver.get("https://www.intellipaat.com/");

          //Resize current window to the set dimension

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

            //To Delay execution for 10 sec. as to view the maximize browser

              Thread.sleep(10000);

              //Close the browser

              driver.quit();

}

}

The Output Analysis is as follows:

It automatically opens the chrome browser, maximizes the browser, waits for a few seconds and closes the browser. 

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...