import scrapy from scrapy_playwright.page import PageMethod class RenderedSpider(scrapy.Spider): name = "rendered" allowed_domains = ["quotes.toscrape.com"] start_urls = ["https://quotes.toscrape.com/js/"] async def start(self): for url in self.start_urls: yield scrapy.Request( url, callback=self.parse, meta={ "playwright": True, "playwright_page_methods": [ PageMethod("wait_for_selector", ".quote"), ], }, ) def parse(self, response): for quote in response.css(".quote .text::text").getall()[:3]: yield {"quote": quote}