Reputation: 11
I have used the below print statements and get_attribute
with value or text returns none. print statement with .text
returns nothing.
print (driver.find_element_by_xpath("//*[@id='lblSuccessMessage']").get_attribute("value"))
print (driver.find_element_by_xpath("//*[@id='lblSuccessMessage']").text)
<strong>
<label id="SuccessMessagelabel">Text message goes here.</label>
</strong>
Upvotes: 1
Views: 7332
Reputation: 50899
The id is SuccessMessagelabel
, not lblSuccessMessage
print (driver.find_element_by_xpath("//*[@id='SuccessMessagelabel']").text)
# or
print (driver.find_element_by_id("SuccessMessagelabel").text)
Upvotes: 2