get text from textarea tag

2156 views python
3

I have textarea as <textarea placeholder="Enter text" ></textarea>

The textarea has some text. But it's not displayed between tags. How can I get it.

e.g. driver.find_element_by_css_selector('textarea[placeholder=""Enter text"]').text

answered question

wait you mean you want the value of 'placeholder'?

1 Answer

8

I can only know for sure if this will work for you if I see your page HTML, but the following xpath should find any textarea element with placeholder of "Enter text":

"//textarea[@placeholder = 'Enter text']"

so your line of code would be

driver.find_element_by_xpath("//textarea[@placeholder = 'Enter text']").text

posted this

Have an answer?

JD

Please login first before posting an answer.