0

I would like to get the text value of a span class "currency-coins value" to be used in a comparison.

Basically I want to check the market value of a specific player. I get the player listed 20 times in a container. So the "currency-coins value" is shown 20 times on the page.

span class = currency-coins Value

Now I need to get the "200" as shown in the screenshot of the HTML code above as value I can work with. And this for all 20 results on the page. The value might be different for all 20 results.

After I got all 20 values, I want to check which one is the lowest.

I will then afterwards use the lowest value as price to list my element on the market.

Is there a way to do this? Since I am learning python for a bit more than one week now, I cant figure it out myself.

2
  • 2
    Can you share the code that you have already tried? Commented Dec 9, 2019 at 10:09
  • 1
    What part are you having troubles with? did you try solving it by yourself? share the code you tried. Commented Dec 9, 2019 at 10:09

1 Answer 1

1

The idea is to first iterate over the player containers - usually, these are table rows, and, for each container, locate that price element within. For instance:

for row in driver.find_elements_by_css_selector("table tbody > tr"):
    coin_value = float(row.find_element_by_css_selector(".currency-coins.value").text)
    print(coin_value)

Note that table tbody > tr is used as an example, your locator for table rows or player containers is likely different.

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.