- 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 perform back and refresh in a browser in Selenium with python?
We can perform back and refresh in the browser in Selenium.
For performing back operation in the browser, the back method is to be used.
For refreshing the browser, refresh method is to be used.
Both these methods can be used for testing browser navigations and reloading of web pages.
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/index.htm") # to print the page title in console print(driver.title) # to print the current URL in console print(driver.current_url) #get method to launch another URL driver.get("https://www.tutorialspoint.com/questions/index.php") # to go back to the previous URL driver.back() #to refresh the browser driver.refresh() #to close the browser driver.close()
- How to perform browser navigations in Selenium?
- How to close a browser session in Selenium with python?
- How to refresh a webpage using Python Selenium Webdriver?
- How to perform drag and drop operation in Selenium with python?
- How to invoke the Chrome browser in Selenium with python?
- How to invoke the Firefox browser in Selenium with python?
- How to invoke the IE browser in Selenium with python?
- How to start selenium browser with proxy?
- Python selenium browser driver.back().
- How to perform releasing a mouse on an element in Selenium with python?
- How to launch Edge browser with Selenium Webdriver?
- How to perform mouse movement to an element in Selenium with python?
- How to maximize or minimize a browser window using Selenium webdriver with Python?