簡體   English   中英

嘗試在Python 3中使用Selenium獲取文本

[英]Trying to get Get text out using selenium in Python 3

這是我要顯示的電子郵件:

在此處輸入圖片說明

這是我的代碼:

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

它什么也沒顯示。 謝謝你的幫助!

通過使用ID來查找該信息會更容易。

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

xpath不正確。 嘗試這個,

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM