Reputation: 1319
I've tried to maximize the window onPreapre by the command below:
browser.driver.manage().window().maximize();
But it doesn't maxmize the window and there's no error on selenium webdriver logs, actually it seems like the execute has been succeed -
Starting ChromeDriver 2.26.436421 (6c1a3ab469ad86fd49c8d97ede4a6b96a49ca5f6) on port 5814
Only local connections are allowed.
17:14:28.898 INFO - Done: [new session: Capabilities [{count=1, browserName=chrome, chromeOptions={args=[--no-sandbox, --test-type, --memory-metrics, --console, --crash-on-failure], prefs={download={directory_upgrade=true, default_directory=./Users/Idan/automation/tests/downloaded/, prompt_for_download=false}}}}]]
17:14:28.909 INFO - Executing: [set script timeout: 90000])
17:14:28.910 INFO - Done: [set script timeout: 90000]
17:14:28.969 INFO - Executing: [maximise window])
17:14:29.236 INFO - Done: [maximise window]
17:14:29.244 INFO - Executing: [maximise window])
17:14:29.250 INFO - Done: [maximise window]
Upvotes: 6
Views: 12323
Reputation: 990
Were facing the same kind of problem and solved using this snippet: (Java)
driver.manage().window().fullscreen();
**Screen goes in the fullscreen mode, and you will not be able to see the address bar, all you will see is the content of the page.
Upvotes: 0
Reputation: 79
I had the same problem with our browser.manage().window().setSize(1024, 768);
, but when I used a better ratio it worked fine browser.manage().window().setSize(1200, 800);
Not sure this will help anyone but hope it does.
Upvotes: 0
Reputation: 1
The best way to maximize a chrome app is through JavaScript. Try this:
//Maximizing Chrome App Window.
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("window.resizeTo(1366, 768);");
Change the parameters 1366, 768 according to your monitor settings/setup.
Upvotes: 0
Reputation: 831
You can use javascript to do this.
((IJavaScriptExecutor)browser).ExecuteScript("window.resizeTo(x, y);");
'x' and 'y' depends on your screen resolution.
Upvotes: 0
Reputation: 3058
You can try it with start-maximized flag:
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['start-maximized']
}
}
Upvotes: 6
Reputation: 473753
I remember we had a similar issue - what we did is first set the size of the window and then maximize - don't remember exactly why did we apply this workaround, but it works for us:
browser.manage().window().setSize(1400, 900);
browser.manage().window().maximize();
Upvotes: 5
Reputation: 21
According to your log - you do maximization twice. Maybe the first time it is maximized, and after the second try it is restored down to default size
Upvotes: 2