Selenium Methods:
get(String URL): get method will navigate to a web page given by the URL.
Example: driver.get("https://testingcolleges.blogspot.com")
title: Get the title of the Current web page.
Example: driver.title
current_url: Gets the Current web page URL.
Example: driver.current_url
page_source: Gets the Current web page source code.
Example: driver.page_source
close(): To close the Current web page window.
Example: driver.close()
quite(): To close all the current browser windows.
Example: driver.quite()
Example Program:
- from selenium import webdriver
- driver = webdriver.Chrome()
- # Navigate to a web site
- driver.get("https://testingcolleges.blogspot.com")
- # To print the title of the current page
- pageTitle = driver.title
- print(pageTitle)
- # To print the current page URL
- pageURL = driver.current_url
- print(pageURL)
- # To close the current browser window
- driver.close()
OUT PUT:
- Testing Colleges
- https://testingcolleges.blogspot.com/
No comments:
Post a Comment