简体   繁体   中英

Trying to get Get text out using selenium in Python 3

this is email i want to show:

在此处输入图片说明

this is my Code :

getemail = driver.find_element_by_xpath(".//b[contains(text(), '@')]").text
print(getemail)

and it showed nothing. Thank you for help!

通过使用ID来查找该信息会更容易。

email = driver.find_element_by_id("email_ch_text").text

The xpath is not accurate. try this,

getemail = driver.find_element_by_xpath(".//b/span[contains(text(), '@')]").text
print(getemail)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM