![]() |
Using Selenium WebDriver, we can set the browser width and height. Various methods are available to set browser width and height. When we run any test, the browser will open in default size. So, if we need to change the size of the browser, we can do it using selenium WebDriver keywords. A few of them are listed below.
Using maximize_window():maximize_window() is one of the methods in the Selenium web driver to set the size of the browser. The function of maximize_window() is to maximize the browser window to full-screen size. Syntax:
Python3
Output:![]() maximize_window(): Using minimize_window():minimize_window() is a method in Selenium web driver to minimize the browser window. It will keep the browser in a docked view or taskbar. Syntax:
Python3
Output:![]() minimize_window() Using set_window_size():The set_window_size() is used to set the size of the browser of the user’s preferred choice. We need to pass the values of width and height to set_window_size(). Syntax:
Python3
Output:![]() set_window_size() Using Chrome options:First need to assign ChromeOptions() to one object let’s say ‘options’ then pass it to the driver to use options. Assigning chrome options to the object ‘options’
Setting the size of the browser window using the below format
Python3
Output:![]() ChromeOptions |
Reffered: https://www.geeksforgeeks.org
Geeks Premier League |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 12 |