• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

SoftwareTestingo - Interview Questions, Tutorial & Test Cases Template Examples

SoftwareTestingo - Interview Questions, Tutorial & Test Cases Template Examples

  • Home
  • Interview Questions
  • Java
  • Java Programs
  • Selenium
  • Selenium Programs
  • Manual Testing
  • Test Cases
  • Difference
  • Tools
  • SQL
  • Contact Us
  • Search
SoftwareTestingo » Selenium » Selenium Programs » How to Maximize Window in Selenium [Chrome Browser Window]?

How to Maximize Window in Selenium [Chrome Browser Window]?

Last Updated on: April 13, 2019 By Softwaretestingo Editorial Board

What We Are Learn On This Post

  • How to Solve the Chrome Browser Maximize Issue?
  • How to maximize the window in selenium?
  • We are getting this exception

How to Solve the Chrome Browser Maximize Issue?

In this post of softwaretestingo blogs, we are going to discuss more in detail about, how you can solve the maximize issue when you are trying to open the Chrome browser using the selenium webDriver. But when you try to open the chrome browser you are maybe getting a WebDriverException but if you go through with your code then you are finding any issue on your code.

Let me told you one simple reason for getting this is you may be using an old version of chrome driver. so you need to download the latest chrome driver from the seleniumHQ website or you can use this link to download the latest chrome driver.

Read Also: Capgemini selenium interview questions
Chome WebDriverException:
package com.selenium;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Maximize_Chrome_Browser 
{
   static
   {
   //set the path of driver executable
   String value=("D:\\Git_Prgms\\softwaretestingblog\\Latest_Env_Jars\\Drivers\\chromedriver.exe");
   System.setProperty("webdriver.chrome.driver", value);
   }
   public static void main(String[] args) throws InterruptedException {
   WebDriver driver=new ChromeDriver();
   driver.get("https://www.google.com");
   driver.manage().window().maximize();
   }

}

How to maximize the window in selenium?

As we know that to maximize the browser window we have used the maximize() method but still, you can see that your window is not maximized, we are getting a WebDriverException for that.

As you see the above code there is nothing wrong with the code but when we try to execute the code we are getting an exception and the browser is not maximized.  The Above Code is run in an environment

Check Also: Wells Fargo Selenium Interview Questions

Selenium Version: Selenium 3.7.1
Chrome Driver Version: ChromeDriver v2.25
Chrome Browser Version: Version 62.0.3202.89

We are getting this exception

Exception in thread “main” org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension from unknown error: page could not be found:

How to Maximize Window in Selenium [Chrome Browser Window]? 1

Note: This Exception comes because of the lower version of Chromedriver, so to fix this we need to update the Chromedriver. so I have updated with the latest Chromedriver that is ChromeDriver 2.33

After Update Here Is The Result:

How to Maximize Window in Selenium [Chrome Browser Window]? 2

I hope this above article about fixing the chrome browser maximize issue can resolve your problem. for more selenium java programs and selenium interview questions, you visit our blog or you can get all updates about our blog by joining of SoftwareTestingo Telegram Group.

    Filed Under: Selenium Programs

    Reader Interactions

    Comments

    1. Avatar for SonaliSonali says

      September 10, 2018 at 12:15 PM

      Thanks for the solution

      Reply
      • Avatar for MaheshMahesh says

        November 23, 2018 at 4:31 PM

        Thanks, it’s working after update the latest chromeDriver

        Reply

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Primary Sidebar

    Join SoftwareTestingo Telegram Group

    Categories

    Copyright © 2022 SoftwareTestingo.com ~ Contact Us ~ Sitemap ~ Privacy Policy ~ Testing Careers