Selenium automated Chrome browser to maximize Windows window

Source: Internet
Author: User

I because is engaged in automation time is not long, so tread a lot of pits. Be prepared to record these pits.

The most basic of automated testing is to open the browser and then maximize the Windows window, if the window is not maximized, the invisible place cannot be automated.

At first Baidu has a lot of window maximization method, the most commonly used is:

Webdriver driver=new chromedriver ();

Driver.manage (). window (). Maximize ();

But I found out that most of the versions didn't work, so I found another way.

Chromeoptions opiions=new chromeoptions ();
Opiions.addarguments ("--start-maximized");
Webdriver driver=new Chromedriver (opiions);

Selenium automated Chrome browser to maximize Windows window

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.