-1
from selenium import webdriver
from bs4 import BeautifulSoup

driver = webdriver.Chrome('./chromedriver')
driver.implicitly_wait(5)
driver.get('http://car.bitauto.com/')

elem = driver.find_elements_by_class_name('yccmp-brand-item ')

print(len(elem))
# returns nothing

driver.quit()

I tried web-scraping data from the Chinese website. For some reason, with the right class name, it returns nothing. I slightly remember it has something to do with dynamic something but not sure how to fix this. Any tips would be appreciated!

enter image description here

  • I can't seem to find anything on that website with the class "yccmp-brand-item". What exactly are you scraping for? – salilnaik Aug 02 '20 at 04:45
  • I'm trying to get a list of brand lists, which is listed under the class name of "yccmp-brand-item". On the website, at the search bar, you can see the list of brands. That's what I want to crawl – Sung Yeon Park Aug 02 '20 at 05:06

1 Answers1

1

Try using the class name item-brand instead.

from selenium import webdriver
from bs4 import BeautifulSoup

driver = webdriver.Chrome('./chromedriver')
driver.implicitly_wait(5)
driver.get('http://car.bitauto.com/')

elem = driver.find_elements_by_class_name('item-brand')

print(len(elem))
# returns nothing

driver.quit()
salilnaik
  • 46
  • 5