5

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: '192.168.0.2', 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.

Michael Durrant
25.3k3 gold badges42 silver badges114 bronze badges
asked Apr 29, 2017 at 4:35

2 Answers 2

1

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();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("--enable-automation");
options.addArguments("test-type=browser");
options.addArguments("disable-infobars");
WebDriver driver = new ChromeDriver(options);
driver.navigate().to("http://gmail.com");

Let me know if this answers your Question.

alecxe
11.4k11 gold badges52 silver badges107 bronze badges
answered May 1, 2017 at 15:31
11
  • 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. Commented 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. Commented 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. Commented May 1, 2017 at 16:09
  • oh sorry ,seen. shall i ask u another question?? Thanks. Commented May 1, 2017 at 16:12
  • @anusharaju Yes, you can Commented May 1, 2017 at 16:14
0

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 .

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.