Если указать маленькое количество машин = ссылок, ошибок нет
вот код
from selenium import webdriver
from selenium.webdriver.common.by import By
from bs4 import BeautifulSoup as bs
import requests
page_count = 3
def get_url(page_count):
urls = []
url = 'https://auto.ria.com/uk/search/?indexName=&page={}&size=20'
for page in range(0, 1 + page_count):
urls_ = url.format(page)
r = requests.get(urls_)
soup = bs(r.text, features='html.parser')
href = soup.find_all('a', class_="m-link-ticket")
for hrefs in href:
urls.append(hrefs.get('href'))
#print(urls)
parsing(urls)
def parsing(urls):
datas = []
driver = webdriver.Chrome()
for url in urls:
driver.get(url)
btn = driver.find_element(By.XPATH, '/html/body/div[6]/div[10]/div[4]/aside/section[2]/div[2]/div/span/a').click()
data = driver.page_source
datas.append(data)
for data in datas:
soup = bs(data, features='html.parser')
name = soup.find_all('h1', class_='head')
print(name)
def main():
get_url(page_count)
if __name__ == '__main__':
main()