- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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
Maximize WebDriver (Selenium 2) in Python.
We can maximize browser window with Selenium webdriver in Python. It is a good practise to maximize the browser while running the tests to reduce the chance of failure.
Once a browser is maximized, the majority of elements become visible to the screen and the probability of interaction with the driver increases. Also, with a maximized browser, users have a better view of the elements on the page.
Some of ways of maximizing browser −
With the maximize_window method
With the fullscreen_window method
Code Implementation with maximize_window()
from selenium import webdriver #set chromedriver.exe path driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") # maximize browser driver.maximize_window() driver.get("https://www.tutorialspoint.com/index.htm") driver.close()
Code Implementation with fullscreen_window()
from selenium import webdriver #set chromedriver.exe path driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") # maximize browser driver.fullscreen_window() driver.get("https://www.tutorialspoint.com/index.htm") driver.close()
In the above examples, we have performed the below steps −
The browser driver path has been configured.
The browser has been launched.
URL has been hit on the browser.
The browser has been maximized.
Finally, the browser has been closed.
- How to maximize the browser window in Selenium WebDriver using C#?
- How to Maximize window in chrome using webDriver (Python)?
- How do I get current URL in Selenium Webdriver 2 Python?
- Running Selenium WebDriver python bindings in chrome.
- How install Selenium Webdriver with Python?
- How to maximize and minimize browsers in Selenium with python?
- Running Selenium Webdriver with a proxy in Python.
- How to handle frames in Selenium Webdriver in Python?
- Selenium RC vs Selenium webdriver.
- Send keys without specifying element in Python Selenium webdriver
- How to click on image in selenium webdriver Python?
- Is navigate method available in Selenium Webdriver with Python?
- Selenium WebDriver StaleElementReferenceException.
- How to set Selenium Python WebDriver default timeout?
- How to maximize the browser in Selenium?