Do you have questions ? We got the answers!

Ask a question:

0
Is it possible to minimize the browser window via Selenium WebDriver

Open 2 Answers 105 Views
I am using Selenium WebDriver Java to automate one web applicaiton. However, I want to minimize the browser window.

Currently I am doing it through Robot Key events. Is there a way to do it via Selenium WebDriver?

2 Answers

1

In Selenium web automation, test automation services uses following to minimize the firefox window using JAVA:


driver.manage().window().setPosition(new Point(-2000, 0))

Test automation services also use below mentioned steps :

Dimension n = new Dimension(360,592);
driver.manage().window().setSize(n);

Using C#, below mentioned step can be used set the position of browser window:

driver.Manage().Window.Position = new System.Drawing.Point(x, y);
 

answered May 18 by rajeevtechexpert (245 points)
0

Robot key events are the ideal way to do that. Selenium has JavaScript in in core. Minimizing the browser window is beyond the scope of JavaScript, so even selenium can no do that. So, the ideal way is to use Robot classes.

Apart from this, if you just want browser window to be out of your sight, you can use below command to move the window away.

driver.manage().window().setPosition(new Point(-2000, 0));

 

answered May 8 by stbadmin (4,970 points)

Top Contributors

  • 4970 pointsstbadmin

    34 questions 454 answers218 comments

  • 433 pointsSunilBhaskar

    41 questions 15 answers32 comments

  • 425 pointsMehedi

    36 questions 3 answers14 comments

  • 363 pointssumitkumarwatts

    0 questions 13 answers0 comments

  • 354 pointsSoft Tester

    43 questions 0 answers4 comments

  • 327 pointsKeeshaGolden

    0 questions 17 answers2 comments

  • 322 pointsVipul Sharma

    44 questions 0 answers24 comments

  • 310 pointsvysh.sharma

    25 questions 0 answers0 comments

  • 267 pointsOnkar_Nimje

    33 questions 15 answers15 comments

  • 258 pointsVanitha

    26 questions 0 answers6 comments

...