I have written some code to get the names of car dealers on one webpage but for some reason it is returning no names.
I have checked the paths and they all seem correct.
import scrapy
import csv
from autotrader2.items import Autotrader2Item
class Autotrader2Spider(scrapy.Spider):
name = "autotrader2"
allowed_domains = ["autotrader.co.uk"]
start_urls =['https://www.autotrader.co.uk/car-dealers/search?advertising-location=at_cars&dealerName=se*&postcode=ab101aa&radius=1501&forSale=on&toOrder=on&page=1&sort=with-retailer-reviews']
def parse(self, response):
for sel in response.xpath('//main/div/article/div[2]/ul'):
name = sel.xpath('.//li/div/header/a/h3/text()').extract()
item = Autotrader2Item()
item['name'] = name
yield item