Categories
Python Answers

How to get text with Selenium WebDriver in Python?

Spread the love

Sometimes, we want to get text with Selenium WebDriver in Python.

In this article, we’ll look at how to get text with Selenium WebDriver in Python.

How to get text with Selenium WebDriver in Python?

To get text with Selenium WebDriver in Python, we use the element’s text property.

For instance, we write

driver.find_element_by_class_name("ctsymbol").text

to call find_element_by_class_name to get the first element with class ctsymbol.

And then we use the text property of it to get the text of the element returned.

Conclusion

To get text with Selenium WebDriver in Python, we use the element’s text property.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *