H
H
haniaman2020-05-30 00:41:50
Parsing
haniaman, 2020-05-30 00:41:50

selenium python. How to parse link values ​​with the same class?

Hello, given a site (rublix.best), and I need to parse the values ​​from the "History of games" column (prnt.sc/sqbv56), but the trick is that the values ​​are links that have 1 and the same class, and this says that it cannot be done through find_element_by_class_name, or I just can't figure out how.

Please help me with how this can be implemented, because I can’t catch up myself :) (I just started learning Selenium for literally a week)

I also have a video on how it turned out in a celik and I would somehow do it so that it was also: yadi.sk/i/J8FcSzueDmHMQg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Yakushenko, 2020-05-30
@haniaman

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions


driver.get('https://rublix.best/')
history_xpath = './/div[@class="history-wrapper"]//div'
WebDriverWait(driver=driver, timeout=15).until(
    expected_conditions.presence_of_element_located((By.XPATH, history_xpath))
)
for elem in driver.find_elements_by_xpath(history_xpath):
    print(elem.get_attribute('textContent'))

Conclusion:
1.22
1.52
4.94
4.25
3.26
1.71
12.16
1.56
1.30
1.18
2.58
1.46
1.91
1.17
4.63
5.01
0
1.44
7.05

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question