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