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]
Use --start-fullscreen argument to Specify the browser should start in fullscreen mode, like if the user had pressed F11 right after startup.
To maximize browser in Selenium, you need to call the maximize() Selenium command to maximize window interface of the driver class. void maximize() – This method is used to maximize the current browser.
You can try it with start-maximized flag:
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['start-maximized']
}
}
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();
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With