websrcraping, find() function not working

  python, python-3.x, web-scraping

i have a wescraping project and i faced a problem in my codes

import requests
from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd
driver = requests.get('https://bama.ir/car')
products= []
prices = []
kilometrs = []

soup = BeautifulSoup(driver.text,'html.parser')
for a in soup.find_all('li',herf=True,attrs={'class':'car-list-item-li list-data-main'}):
    name=a.find('div', attrs={'class':'title'})
    price=a.find('p', attrs={'class':'cost single-price'})
    kilometr=a.find('div', attrs={'class':'car-func-details'})
    products.append(name.text)
    prices.append(price.text)
    kilometrs.append(kilometr.text)
    print(kilometr.text)
df = pd.DataFrame({'Product Name':products,'Price':prices,'kilometr':kilometrs}) 
df.to_csv('products.csv', index=False, encoding='utf-8')

a.find() is not working and i have no idea why!!can u help me ?

Source: Python Questions

LEAVE A COMMENT