- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 do I get current URL in Selenium Webdriver 2 Python?
- How to maximize or minimize a browser window using Selenium webdriver with Python?
- How to maximize the browser window in Selenium WebDriver using C#?
- How to Maximize window in chrome using webDriver (Python)?
- How install Selenium Webdriver with Python?
- Running Selenium WebDriver python bindings in chrome.
- Wait for an Ajax call to complete with Selenium 2 WebDriver.
- Selenium RC vs Selenium webdriver.
- Selenium WebDriver StaleElementReferenceException.
- Explain explicit wait in Selenium webdriver in Python.
- Explain implicit wait in Selenium webdriver in Python.
- How to check if dom has a class using WebDriver (Selenium 2)?
- Running Selenium Webdriver with a proxy in Python.
- How to maximize and minimize browsers in Selenium with python?
- How to maximize the browser in Selenium?