Navigation Commands:
Navigation Commands are used to navigate window base actions in the browser.
1. get("URL"): Get method will navigate to a web page given by the URL.
Example: driver.get("https://testingcolleges.blogspot.com")
2. back(): It does the same operation as clicking on the back button (←) of any browser.
Example: driver.back()
3. forward(): It does the same operation as clicking on the forward button (→) of any browser.
Example: driver.forward()
4. refresh(): To refresh the current web page.
Example: driver.refresh()
Example Program for Browser Navigation Commands:
- import time
- from selenium import webdriver
- driver = webdriver.Chrome()
- driver.get("https://www.google.com/")
- driver.get("https://www.facebook.com/")
- driver.back()
- driver.forward()
- time.sleep(2)
- driver.refresh()
- time.sleep(2)
- driver.quite()
OUTPUT:
No comments:
Post a Comment