How to maximize the Opera browser

1,049 views
Skip to first unread message

Srividya Subramani

unread,
Jun 18, 2012, 9:52:39 AM6/18/12
to seleniu...@googlegroups.com
Hi All,

Kinldy anybody send me the code for maximize the Opera browser(version 11.64).
I can able to launch and do the operation but i dont know how to maximize the browser
I  used driver.manage().window().maximize(); but not working..


Thanks in Advance

Regards,
Srividhya.

Srividya Subramani

unread,
Jun 19, 2012, 1:31:42 AM6/19/12
to seleniu...@googlegroups.com
Hi All,

Any idea, Please give me a suggestion on this.

Regards,
Srividya.

Debasish Dutta

unread,
Jun 19, 2012, 1:33:25 AM6/19/12
to seleniu...@googlegroups.com
i think browser is opening in maximize mode in webdriver.

On Tue, Jun 19, 2012 at 11:01 AM, Srividya Subramani
<srividya....@photoninfotech.net> wrote:
> Hi All,
>
> Any idea, Please give me a suggestion on this.
>
> Regards,
> Srividya.
>
>
>
> On Mon, Jun 18, 2012 at 7:22 PM, Srividya Subramani
> <srividya....@photoninfotech.net> wrote:
>>
>> Hi All,
>>
>> Kinldy anybody send me the code for maximize the Opera browser(version
>> 11.64).
>> I can able to launch and do the operation but i dont know how to maximize
>> the browser
>> I  used driver.manage().window().maximize(); but not working..
>>
>>
>> Thanks in Advance
>>
>> Regards,
>> Srividhya.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com.
> To unsubscribe from this group, send email to
> selenium-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/selenium-users?hl=en-US.

Srividya Subramani

unread,
Jun 19, 2012, 1:43:19 AM6/19/12
to seleniu...@googlegroups.com
Hi,

I am using selenium 2.21.0 ,opera version 11.64 and opera driver 0.14 but am not able to see the browser maximize.

Regards,
Srividya.

Debasish Dutta

unread,
Jun 19, 2012, 1:55:37 AM6/19/12
to seleniu...@googlegroups.com
http://stackoverflow.com/questions/3189430/how-do-i-maximize-the-browser-window-using-webdriver-selenium-2


check the above link.



On Tue, Jun 19, 2012 at 11:13 AM, Srividya Subramani

Debasish Dutta

unread,
Jun 19, 2012, 1:57:19 AM6/19/12
to seleniu...@googlegroups.com
you can use driver.manage().window().setSize(mention size of window);

Lingam Rajesh

unread,
Jun 19, 2012, 1:57:06 AM6/19/12
to seleniu...@googlegroups.com
The driver maximize is not implemented by Opera Driver.

You can try the below 

//Code to Maximize the browser
            driver.manage().window().setPosition(new Point(0, 0));
            Dimension dim = new Dimension(1600, 900);
            driver.manage().window().setSize(dim);

Regards,
Rajesh

Srividya Subramani

unread,
Jun 19, 2012, 2:19:58 AM6/19/12
to seleniu...@googlegroups.com
Hi,

On using the below code my browser closes suddenly after launching .

Regards,
Srividya.

sai kiran nukala

unread,
Jun 19, 2012, 2:22:02 AM6/19/12
to seleniu...@googlegroups.com
can you please put the piece of code that you are trying with ? In the above code there is no line of code which closes it. Can you give us more info. snippet of code, log or any exceptions etc... 


On Tuesday, 19 June 2012 11:49:58 UTC+5:30, Srividya Subramani wrote:
Hi,

On using the below code my browser closes suddenly after launching .

Regards,
Srividya.

On Tue, Jun 19, 2012 at 11:27 AM, Lingam Rajesh <lingamr...@gmail.com> wrote:
The driver maximize is not implemented by Opera Driver.

You can try the below 

//Code to Maximize the browser
            driver.manage().window().setPosition(new Point(0, 0));
            Dimension dim = new Dimension(1600, 900);
            driver.manage().window().setSize(dim);

Regards,
Rajesh
> To post to this group, send email to selenium-users@googlegroups.com.

> To unsubscribe from this group, send email to

> For more options, visit this group at
> http://groups.google.com/group/selenium-users?hl=en-US.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Srividya Subramani

unread,
Jun 19, 2012, 2:32:29 AM6/19/12
to seleniu...@googlegroups.com
Hi,

I used the below code, opera launches and i could find the print statement but later browser suddenly closes and shows null pointer exception.

driver = new OperaDriver();
System.out.println("******window maximized********");
driver.manage().window().maximize();
driver.navigate().to(url + context);

And the same happens with the below..

driver = new OperaDriver();
System.out.println("******window maximized********");

driver.manage().window().setPosition(new Point(0, 0));
    Dimension dim = new Dimension(1600, 900);
    driver.manage().window().setSize(dim);
driver.navigate().to(url + context);

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/U-a1A3Y3LQIJ.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

sai kiran nukala

unread,
Jun 19, 2012, 3:40:10 AM6/19/12
to seleniu...@googlegroups.com
can you please paste the exception too ?

Srividya Subramani

unread,
Jun 19, 2012, 6:12:29 AM6/19/12
to seleniu...@googlegroups.com
Hi,
 this what i got..

INFO: -------------***LAUNCHING OPERA***--------------
Exception in thread "stp-thread" java.nio.channels.ClosedSelectorException
    at sun.nio.ch.SelectorImpl.selectedKeys(Unknown Source)
    at com.opera.core.systems.util.SocketMonitor.pollSockets(SocketMonitor.java:132)
    at com.opera.core.systems.util.SocketMonitor.poll(SocketMonitor.java:108)
    at com.opera.core.systems.scope.stp.StpThread.run(StpThread.java:60)


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/-_pPgeQCux8J.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

sai kiran nukala

unread,
Jun 19, 2012, 6:30:45 AM6/19/12
to seleniu...@googlegroups.com
Instead of going behind this exception I would suggest a small workaround for maximizing the window and should see whether it is working or not. Try using below, we will try to maximize the browser using javascript and let us know.

WebDriver driver = <Assign your driver>;
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("top.window.moveTo(0,0); top.window.resizeTo(screen.availWidth, screen.availHeight);");

Srividya Subramani

unread,
Jun 19, 2012, 7:15:54 AM6/19/12
to seleniu...@googlegroups.com
Hi,

Thanks for your reply. But unfortunately the below snippet also not maximizing the browser window. If any other way please let me know.
 
Thanks,
Srividya. 

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/CH93XHVMhj8J.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

Naresh

unread,
Jun 19, 2012, 7:33:47 AM6/19/12
to seleniu...@googlegroups.com
Hello,

Following is working for me.

 var screenResolution = new Size(SystemInformation.PrimaryMonitorSize.Width, SystemInformation.PrimaryMonitorSize.Height);
_webDriver.Manage().Window.Size = screenResolution;

And the above code is C#.Net.

Thanks,
Naresh

Srividya Subramani

unread,
Jun 19, 2012, 7:40:20 AM6/19/12
to seleniu...@googlegroups.com
Hi,

Can you send the same in java.I use java .

Thanks,
Srividya.


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

prateek shaw

unread,
Jun 19, 2012, 8:00:15 AM6/19/12
to seleniu...@googlegroups.com
Hi ,

Use following code which will help you make any window maximize.Since WebDriver has method but it does not support Mozilla Firefox 12 version or might be other browser .

That is reason why we are using this way to make the window full size

    public static void maximizingWindow(Selenium selenium) throws Exception {
        //bring the browser window into focus
        selenium.windowFocus();
        //invoke the system menu using robot
        Robot robot = new Robot();
        robot.keyPress(KeyEvent.VK_ALT);
        robot.keyPress(KeyEvent.VK_SPACE);
        robot.keyRelease(KeyEvent.VK_ALT);
        robot.keyRelease(KeyEvent.VK_SPACE);
        Thread.sleep(1000);

        //Press down arrow key to move down the menu
        robot.keyPress(KeyEvent.VK_DOWN);
        robot.keyRelease(KeyEvent.VK_DOWN);
        Thread.sleep(100);

        robot.keyPress(KeyEvent.VK_DOWN);
        robot.keyRelease(KeyEvent.VK_DOWN);
        Thread.sleep(100);

        robot.keyPress(KeyEvent.VK_DOWN);
        robot.keyRelease(KeyEvent.VK_DOWN);
        Thread.sleep(100);

        robot.keyPress(KeyEvent.VK_DOWN);
        robot.keyRelease(KeyEvent.VK_DOWN);
        Thread.sleep(100);

        //Press enter to invoke the Maximize menu option
        robot.keyPress(KeyEvent.VK_ENTER);
        robot.keyRelease(KeyEvent.VK_ENTER);

sai kiran nukala

unread,
Jun 19, 2012, 8:33:13 AM6/19/12
to seleniu...@googlegroups.com
I have tried maximizing window with javascript faced various issues, if script works with IE, it doesn't work with opera. I thought of using Robot Class which is the final option. Although this is not right way to maximize the window. You should avoid this once the implementation of maximize() is available for OperaDriver. Try this one and tell us.

        Robot robot = new Robot();
        robot.keyPress(KeyEvent.VK_ALT);
        robot.keyPress(KeyEvent.VK_SPACE);
        robot.keyRelease(KeyEvent.VK_ALT);
        robot.keyRelease(KeyEvent.VK_SPACE);
        robot.keyPress(KeyEvent.VK_X);
        robot.keyRelease(KeyEvent.VK_X);

On Tuesday, 19 June 2012 17:10:20 UTC+5:30, Srividya Subramani wrote:
Hi,

Can you send the same in java.I use java .

Thanks,
Srividya.


On Tue, Jun 19, 2012 at 5:03 PM, Naresh <naresh...@gmail.com> wrote:
Hello,

Following is working for me.

 var screenResolution = new Size(SystemInformation.PrimaryMonitorSize.Width, SystemInformation.PrimaryMonitorSize.Height);
_webDriver.Manage().Window.Size = screenResolution;

And the above code is C#.Net.

Thanks,
Naresh

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

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Srividya Subramani

unread,
Jun 19, 2012, 8:49:53 AM6/19/12
to seleniu...@googlegroups.com
Hi All,

The below code worked for me for maximizing the browser.Thanks for solving this issue.

Thanks&Regards,
Srividya.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/gSZcYlFVpWEJ.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

prem kumar

unread,
Jun 28, 2012, 8:23:54 AM6/28/12
to seleniu...@googlegroups.com
Hi Vidhya,
 
Use

Driver.manage().window().maximize();

It works fine..

Regards,

Prem

Reply all
Reply to author
Forward
0 new messages