Reputation: 2458
I would like to share my observation related with text property of WebElement. I have a pdf link:
The file name has triple whitespace and when I try to get text property of the element enclosed in tag , just receive truncated string from extra whitespaces:
"03057895_05-01-2015_platform express array induction sp gr hsts neutron density log.pdf"
And it comes for me very critical to find out this issue, cause I used text to identify the downloaded file name and monitor the download status of the file.
Anybody have encountered something like that previously or maybe know why is it work in a such a manner?
Upvotes: 1
Views: 928
Reputation: 5137
As @Eric commented, this is not a problem of selenium. It is an issue in your application. However, if you really want to get that text, you have to get attribute innerHTML. See code below:
text = driver.find_element_by_css_selector("a").get_attribute("innerHTML")
Upvotes: 1