- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Resize Browser Window in WebDriver?
We can resize the browser window in Selenium webdriver. We can configure the size of the browser with the help of the set_window_size method in Python.
The dimensions of the window size are passed as parameters to this method. Again, to get the size of the browser, we can use the method get_window_size.
Syntax
driver.set_window_size(200,500)
Example
Code Implementation
from selenium import webdriver #set geckodriver.exe path driver = webdriver.Firefox(executable_path="C:\geckodriver.exe") #maximize browser driver.maximize_window() #launch URL driver.get("https://www.tutorialspoint.com/index.htm") #new browser size driver.set_window_size(800, 880) #get window size print(driver.get_window_size()) #close browser driver.close()
Output
- Related Articles
- What is cross-browser window resize events in JavaScript?
- How to close child browser window in Selenium WebDriver using Java?
- How to maximize the browser window in Selenium WebDriver using C#?
- How to open browser window in incognito/private mode using python selenium webdriver?
- How to close the whole browser window by keeping the webDriver active?
- How to open a browser window in full screen using Selenium WebDriver with C#?
- How to open a new window on a browser using Selenium WebDriver for python?
- How to resize the background image to window size in Tkinter?
- How can I resize the root window in Tkinter?
- How to hide Firefox window (Selenium WebDriver)?
- How to launch Edge browser with Selenium Webdriver?
- How to Maximize window in chrome using webDriver (Python)?
- How does selenium webdriver upload files to the browser?
- How to create a browser window example with CSS?
- How to set the size of the browser window in Selenium?

Advertisements