1

How can I get the text "950" from the div that has neither a ID nor a Class with python selenium?

<div class="player-hover-box" style="display: none;">
    <div class="ps-price-hover">
        <div><img class="price-platform-img-hover"></div>
        <div>950</div>
    </div>

I dont know how I could access this div and its text.

0

1 Answer 1

1

In case player-hover-box is an unique class name you can use the following command

price = driver.find_element_by_xpath('//div[@class="player-hover-box"]/div/div[2]').text

In case there are more products on that page with the similar HTML structure your XPath locator should contain some unique relation to some other element.

Sign up to request clarification or add additional context in comments.

Comments

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.