Created
August 15, 2020 12:26
-
-
Save kipronokoech/6e51e5f44dadece5b906828cd5419b8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
import time | |
PATH = "./chromedriver" | |
driver = webdriver.Chrome(PATH) | |
driver.get(url="file:///home/kiprono/Desktop/untitled.html") | |
print("Element identified by id:",driver.find_element_by_id("JDCf").text) | |
print("Element identified by class:",driver.find_element_by_class_name("container1").text) | |
print("Element identified by class:",driver.find_element_by_class_name("col4").text) | |
print("Element identified by tag name:",driver.find_element_by_tag_name("h1").text) | |
print("Element identified by xpath:",driver.find_element_by_xpath("/html/body/p").text) | |
time.sleep(5) | |
driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment