There are multiple common web driver methods that allow operation on browsers in Selenium with Python. Some of these methods are listed below −
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.
This method is used to maximize the active window that is interacting with the web driver.
This method is used to minimize the active window that is interacting with the web driver.
This method is used to move to a single step back in the history of browsers.
This method is used to move to a single step forward in the history of browsers.
This method is used to refresh the current page.
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()