- 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
How to Maximize window in chrome using webDriver (Python)?
We can maximize windows on Chrome with a webdriver. While working on any automated test cases, if the browser opens in maximized mode then the probability of the scripts getting failed lessens.
This is because if the element is visible, then the chances of its interaction increases. Also, if the window is maximized, then the testers or developers working on them gets a better visibility of the test steps.
Some of the applications open in maximized mode automatically. Applying maximizing techniques on them does not have any impact on them. Let us see the methods with which we can maximize window in chrome in python −
Using maximize_window() method.
Using fullscreen_window() method.
Code Implementation with maximize_window().
from selenium import webdriver driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") # maximize with maximize_window() driver.maximize_window() driver.get("https://www.tutorialspoint.com/index.htm") driver.quit()
Code Implementation with fullscreen_window().
from selenium import webdriver driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") # maximize with maximize_window() driver.fullscreen_window() driver.get("https://www.tutorialspoint.com/index.htm") driver.quit()
So in the above code implementations we have done the following steps −
Launched the Chrome browser.
Opened an URL.
Maximized the Chrome browser.
Quitted the driver session.
- How to maximize the browser window in Selenium WebDriver using C#?
- How to maximize or minimize a browser window using Selenium webdriver with Python?
- How to maximize a plt.show() window using Python?
- Maximize WebDriver (Selenium 2) in Python.
- How to set Google Chrome in WebDriver?
- Running Selenium WebDriver python bindings in chrome.
- How to set window size using phantomjs and selenium webdriver in Python?
- How to open browser window in incognito/private mode using python selenium webdriver?
- How to use chrome webdriver in Selenium to download files in Python?
- How to Resize Browser Window in WebDriver?
- How to close child browser window in Selenium WebDriver using Java?
- How to run Selenium WebDriver test cases in Chrome?
- How to hide Firefox window (Selenium WebDriver)?
- How do I open Chrome in selenium WebDriver?
- How to open a new window on a browser using Selenium WebDriver for python?