"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to Extract Text with Selenium WebDriver in Python?

How to Extract Text with Selenium WebDriver in Python?

Published on 2024-11-07
Browse:560

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
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3