Home > Article > Backend Development > How to Extract Text with Selenium WebDriver in Python?
How do I capture text using Selenium WebDriver in Python
This issue occurs when trying to get text using Selenium WebDriver by utilizing the getText() method with a parameter passed into it.
To fix it, simply use .text instead.
Remember to verify the text after obtaining it, rather than attempting to pass in the expected text during the retrieval process.
Here's how the code should look like:
text = driver.find_element_by_class_name("current-stage").text
The above is the detailed content of How to Extract Text with Selenium WebDriver in Python?. For more information, please follow other related articles on the PHP Chinese website!