- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
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
What are the common driver methods that can be applied to browsers in Selenium with python?
There are multiple common web driver methods that allow operation on browsers in Selenium with Python. Some of these methods are listed below −
driver.get(url)
This method is used to navigate or launch a new URL. The webdriver waits until there is full page load. For an application that has AJAX code, the web driver remains unaware about complete loading of the page. Thus for these situations we need to use waits.
driver.maximize_window()
This method is used to maximize the active window that is interacting with the web driver.
driver.minimize_window()
This method is used to minimize the active window that is interacting with the web driver.
driver.back()
This method is used to move to a single step back in the history of browsers.
driver.forward()
This method is used to move to a single step forward in the history of browsers.
driver.refresh()
This method is used to refresh the current page.
Example
Code Implementation with browser methods.
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.Chrome(executable_path="C:\chromedriver.exe") # to maximize the browser window driver.maximize_window() #get method to launch the URL driver.get("https://www.tutorialspoint.com/about/about_careers.htm") #to maximize the browser driver.maximize_window() #to refresh the browser driver.refresh() #get method to launch another URL driver.get("https://www.tutorialspoint.com/index.htm") #to minimize the browser driver.minimize_window() #to move one step back in browser history driver.back() #to move one step forward in browser history driver.forward() #to close the browser driver.close()
- Related Articles
- How to maximize and minimize browsers in Selenium with python?
- How to get text with selenium web driver in python?
- What are the differences between close() and quit() methods in Selenium with python?
- What are the differences between switch_to_default_content() and switch_to.parent_frame() methods in Selenium with python?
- What are the differences between current_window_handle and window_handles methods in Selenium with python?
- What are the pre-conditions for Selenium Internet Explorer Driver or IE Driver?
- How can I download Microsoft WebDriver/Edge Driver to use with Selenium?
- What are the methods available for handling static dropdowns in a page in Selenium with python?
- What is Web Driver in Selenium?
- What are the different cookies methods in Selenium?
- What is selenium web driver?
- What is Selenium Internet Explorer Driver or IE Driver?
- What is the Selenium Web Driver Architecture?
- Get text using selenium web driver in python?
- What is the command used to register gecko driver in Selenium?
