Web scraping using python

Asked

Viewed 15 times

1

I would like to print all the Divs of a particular website that are contained within a superior div

<div class="history-feed__collection">
     <div class="history-feed__card h-card h-card_sm h-card_spades" style="width: 41px; margin-right: 18px; opacity: 1;">
         <div class="h-card__sign">9</div></div>
     <div class="history-feed__card h-card h-card_sm h-card_hearts" style="width: 41px; margin-right: 18px; opacity: 1;">
         <div class="h-card__sign">K</div></div>
     <div class="history-feed__card h-card h-card_sm h-card_diamonds" style="width: 41px; margin-right: 18px; opacity: 1;">
         <div class="h-card__sign">Q</div></div>
     <div class="history-feed__card h-card h-card_sm h-card_clubs" style="width: 41px; margin-right: 18px; opacity: 1;">
         <div class="h-card__sign">2</div></div>

I would like the program to list for example "history-feed__card h-card h-card_sm h-card_spades, history-feed__card h-card h-card_sm h-card_hearts,... "I started this code, but I still find problems

from selenium import webdriver

driver = webdriver.Chrome(executable_path='C:\chromedriver')

driver.get('https://card.com')

id = driver.find_elements_by_xpath('//*[@class]')

for ii in id:
    print(ii.get_attribute('class="hilo-history-feed__collection"'))
    
driver.close()
  • What problems?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.