<h1 align='center'>MD5 encrypt this string</h1><h3
align='center'>pc08BLh9x7fCaZTHux9n</h3><center><form action=""
method="post">
Please help me take the string in h3 tags:! I tried this but got nothing:
from selenium import webdriver
driver = webdriver.Chrome('C://Program Files//webdrivers//chromedriver.exe')
driver.get('https://www.google.gr/')
string=driver.find_element_by_tag_name(h3)
h3 tag is not present on your site. so I have replaced that with a tag. please refer below solution to print associated with your tag
driver = webdriver.Chrome(executable_path=r"chrome driver path")
driver.get('https://www.google.gr/')
string=driver.find_element_by_tag_name("a")
print string.text
Also, if you want to retrieve text of all tags then you can use find_elements_by_tag_name
. please refer below for the same.
string=driver.find_elements_by_tag_name("a")
for element in string:
print element.text
If you are wanting the text of the h3 element then you need to do this:
string=driver.find_element_by_tag_name(h3).text
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.