Java + Selenium window () interface method Introduction

Source: Internet
Author: User

In the browser-initiated code, there is a call to the window interface, and this article explains the interface. The code is as follows

Driver.manage (). window (). Maxmize ();

The window interface is primarily used to control the settings of the browser window. For example, size, maximum, minimum, full screen, location, and so on.

void SetSize (Dimension targetsize): Customizes the size of a window. Note that Targetsize is a class, so we have to set it up in advance.

Dimension getsize (): Gets the size of the window.

Code examples are as follows

New Dimension (1024x768, 768);  Set the window size to 1024*768driver.manage (). Windows (). SetSize (Targetsize);
System.out.println (Driver.manage (). window (). GetSize ());

void SetPosition (Point targetposition): Customizes the location where the browser window appears. Pixel point positioning. Note that Targetposition is a class, so we have to set it up in advance.

Point GetPosition (): Gets the window position information.

Code examples are as follows

New Point (a);       The point in the upper-left corner of the setting window appears in the position (300,600) driver.manage (). window (). SetPosition (targetposition);
System.out.println (Driver.manage (). window (). getPosition ());

void Maxmize (): Maximized window.

void fullscreen (): Window fullscreen.

The above is the introduction of the window interface used.

Java + Selenium window () interface method Introduction

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.