- Trending Categories
- Data Structure
- Operating System
- MS Excel
- 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
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.
- Related Articles
- How to maximize the browser window in Selenium WebDriver using C#?
- How to maximize a plt.show() window using Python?
- Maximize WebDriver (Selenium 2) in Python.
- 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 set Google Chrome in WebDriver?
- How to use chrome webdriver in Selenium to download files in Python?
- Running Selenium WebDriver python bindings in chrome.
- How to close child browser window in Selenium WebDriver using Java?
- How to open a new window on a browser using Selenium WebDriver for python?
- How to Resize Browser Window in WebDriver?
- How to run Selenium WebDriver test cases in Chrome?
- How to open a link in new tab of chrome browser using Selenium WebDriver?
- How do I open Chrome in selenium WebDriver?
- How to mute all sounds in chrome webdriver with selenium?