Philip
Philip

Reputation: 69

Trying to get Get text out using selenium in Python 3

this is email i want to show:

enter image description here

this is my Code :

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

and it showed nothing. Thank you for help!

Upvotes: 1

Views: 51

Answers (2)

NoodleBeard
NoodleBeard

Reputation: 106

It would be easier to find that information by using the ID instead.

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

Upvotes: 3

Sureshmani Kalirajan
Sureshmani Kalirajan

Reputation: 1938

The xpath is not accurate. try this,

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

Upvotes: 0

Related Questions