when i use object.manage().window().maximize(); method the window is not maximizing . The following error shown

Starting ChromeDriver 2.29.461591 (62ebf098771772160f391d75e589dc567915b233) on port 24144
Only local connections are allowed.
Apr 29, 2017 10:04:02 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
  (Session info: chrome=57.0.2987.133)
  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.04 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'NBW7BANINFOS6', ip: '', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461591 (62ebf098771772160f391d75e589dc567915b233), userDataDir=C:\Users\ADMINI~1\AppData\Local\Temp\scoped_dir10152_31085}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=57.0.2987.133, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 824bcb85e7d4e2ad25f1600b97d66907
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:694)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:925)
    at vaishu.Mounika.main(Mounika.java:16)

please tell me solution.

2 Answers 2


To work with latest Chrome drivers 2.29 you need to maximize the window using Chrome Options class as follows:

System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
WebDriver driver = new ChromeDriver(options);

Let me know if this answers your Question.

  • thank you its working , but it is very lengthy . manage().window().maximize() why it is not working. if u know please tell and once again thank you. May 1, 2017 at 15:53
  • yes u said perfect answer. & my question is manage().window().maximize() method should work to maximize the window. but it is not working on neither chrome nor mozilla why???? Thanks. May 1, 2017 at 16:05
  • I think I have already answered your Question in my Answer itself. Mozilla still works with driver.manage().window().maximize() Thanks. May 1, 2017 at 16:09
  • oh sorry ,seen. shall i ask u another question?? Thanks. May 1, 2017 at 16:12
  • @anusharaju Yes, you can May 1, 2017 at 16:14

Some times maximize window doesn't work with old version of web driver . So solution is to update the web driver and give the update driver path in program .

  • 1
    I'm afraid this answer isn't substantially different from the accepted answer. Could you clarify how it is?
    – corsiKa
    Dec 12, 2018 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.