-1

I am trying to webscrap data from roulette game. While trying to

find element by class name (roulette_round_result-position__text)

I am getting this output:

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

Any idea how to scrap this value? (In this case number 2)

My code:

number_1=0
    while number_1 == 0:
        try:
            number_1 = self.driver.find_element_by_class_name('roulette-round-result-position__text')
        except:
            pass

Screen shot from DevTools:

Screen shot from DevTools

2
  • print(number1.text) To get the text out. Also include the html as code not a screenshot. Commented Dec 16, 2021 at 21:51
  • Also make sure your class name is unique otherwise you would just get another element. Commented Dec 16, 2021 at 21:52

1 Answer 1

-1

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)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for solving this problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.