M
M
Mykyta_M2018-08-14 23:21:39
Python
Mykyta_M, 2018-08-14 23:21:39

How to pull this value using Python Selenium Webdriver?

Hello!
I can’t pull out the number of people who voted from this site
Product name and link I pull out without problems.
*Ignore the structure of the code, i and loops will come in handy later

product_block = driver.find_element_by_css_selector("ul[class*='postsList']")
        li_tags = product_block.find_elements_by_tag_name("li")
        i = 1
        while i < len(li_tags):
            for li in li_tags:
                name = li.find_element_by_css_selector("h2").text
                link = li.find_element_by_css_selector("a").get_attribute("href")
                #print(name)
                #print(link)
                i = i+1

Thank you in advance for your help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-08-14
@dimonchik2013

Xpath instead of CSS, something like
/span[contains(@class,"buttonContainer")]/text()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question