Maximize browser window

627 views
Skip to first unread message

Attila

unread,
Aug 20, 2009, 4:05:03 PM8/20/09
to webdriver
Hi,

Is there a method in WebDrive I could use to maximize the browser
window after the browser was started?

Thank you,

Attila

Jason

unread,
Aug 20, 2009, 5:04:54 PM8/20/09
to webdriver
The WebDriver API doesn't provide one directly, but you can achieve it
using JavaScript.

((JavaScriptExecutor) driver).executeScript("if (window.screen)
{window.moveTo(0, 0);window.resizeTo(window.screen.availWidth,
window.screen.availHeight);};");

This is exactly what we do for WebDriverBackedSelenium (see
#windowMaximize()):
http://code.google.com/p/selenium/source/browse/webdriver/trunk/selenium/src/java/org/openqa/selenium/WebDriverBackedSelenium.java

Attila

unread,
Aug 21, 2009, 5:03:30 AM8/21/09
to webdriver
It works :)

Thank you,

Attila

alladi sai

unread,
Dec 6, 2012, 11:28:32 PM12/6/12
to webd...@googlegroups.com
Hi Mahesh,

It  won't work for the Opera browser. Is there anyway to maximize the Opera browser using Webdriver.

Thanks in Advance.

Regard's
Sai ....

On Thu, Dec 6, 2012 at 11:47 AM, uthota <thotam...@gmail.com> wrote:
Hi All,

By using below command you can maximize the browser window

driver.manage().window().maximize();

cheers,
uthota

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/0ejooVGsMHoJ.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.



--
Regard's

Sai..

Mark Collin

unread,
Dec 7, 2012, 1:29:37 AM12/7/12
to webd...@googlegroups.com

DesiredCapabilities caps = DesiredCapabilities.opera()

caps.setCapability("opera.arguments", "-nowin -nomail -fullscreen");

 

return new OperaDriver(caps)

 

See:

 

http://code.google.com/p/selenium/wiki/OperaDriver

 

and

 

http://www.opera.com/docs/switches/

alladi sai

unread,
Dec 7, 2012, 3:00:32 AM12/7/12
to webd...@googlegroups.com
Thanks for reply mark,

Using below option the browser will open in the Full screen, But i want to open browser in maximize mode, 

Is there anyway to achieve this.

Regard's
Sai ....
--
Regard's

Sai..

darrell

unread,
Dec 7, 2012, 10:23:04 AM12/7/12
to webd...@googlegroups.com
Maximizing a window is a function of the operating system. WebDriver exists INSIDE the chrome of the web browser. In other words, the concept of maximizing the window is not a web browser feature, it is an operating system feature. It actually does not even exist on Mac OS X. So it would be specific to the Windows operating system.

If you are using RemoteWebDriver you are limited to WebDriver. If you are using a local WebDriver, i.e. web browser is on the same machine as the WebDriver client code, then you can use native code to maximize the window. That is, go outside of the commands in the WebDriver jar files and just maximize the window.

Darrell

Mark Collin

unread,
Dec 9, 2012, 4:21:56 AM12/9/12
to webd...@googlegroups.com

The difference between full screen and maximised are…

Lukus

unread,
Dec 10, 2012, 12:38:50 PM12/10/12
to webd...@googlegroups.com
Here's a post where I talk out a few solutions that have worked for me.

https://groups.google.com/d/msg/selenium-users/1KYLzNY5GcM/_QzxsxcNQgwJ

alladi sai

unread,
Dec 11, 2012, 5:28:31 AM12/11/12
to webd...@googlegroups.com
Hi Lukus,

I have tried all the solutions which you have mentioned in your post.
unfortunately none of the solution worked for me .

Reasons being.

The solution 1 which worked for IE and all but Opera it's not working.( moveTo(0,0) in Opera, results in moving the window to the top left corner of the browser, not the screen )
The solution 2 i can't use , as i am working with Dotnet , there is no such class exist.
The solution 3 will is throwing an exception.
The solution 4 will only works for a Chrome browser.

Regard's
Sai baba

On Mon, Dec 10, 2012 at 11:08 PM, Lukus <luke....@gmail.com> wrote:
Here's a post where I talk out a few solutions that have worked for me.

https://groups.google.com/d/msg/selenium-users/1KYLzNY5GcM/_QzxsxcNQgwJ

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/sgsgQpjUah8J.

To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.



--
Regard's

Sai..
Reply all
Reply to author
Forward
0 new messages