
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 and Minimize Browsers in Selenium with Python
We can maximize and minimize the browser while we are testing an application in Selenium.
For maximizing the browser, maximize() method is to be used.
For minimizing the browser, minimize() method is to be used.
Both these methods can be used simultaneously in the same program.
Example
Code Implementation
from selenium import webdriver #browser exposes an executable file #Through Selenium test we will invoke the executable file which will then #invoke actual browser driver = webdriver.Firefox(executable_path="C:\geckodriver.exe") # to maximize the browser window driver.maximize_window() #get method to launch the URL driver.get("https://www.tutorialspoint.com/index.htm") #to refresh the browser driver.refresh() # to minimize the browser window driver.minimize_window() #to close the browser driver.close()
Advertisements