Selenium Python: How to web scrape the element text

You are printing the WebElement. Hence you see the output as:

<selenium.webdriver.remote.webelement.WebElement (session="d4f20fd17bf4037ed8cf50b00e844a7f", element="f12cf837-6c77-4c90-9da2-7b5fb9da9e5d")>

Instead you may like to print the text within the element as:

number_1 = self.driver.find_element_by_class_name('roulette-round-result-position__text')
print(number_1.text)

or

print(self.driver.find_element_by_class_name('roulette-round-result-position__text').text)

Leave a Comment