scrapy-plugins / scrapy-playwright

🎭 Playwright integration for Scrapy
BSD 3-Clause "New" or "Revised" License
911 stars 101 forks source link

Unable to save downloaded file #259

Closed sanjeethboddi closed 5 months ago

sanjeethboddi commented 5 months ago
yield scrapy.Request(
      url,
      meta={
      'playwright': True,
      'playwright_include_page': True, 
      'playwright_page_methods':[
          ...
          PageMethod("click", selector='#export > ul > li > button'), # downloads csv file
          ...

          ],

      'errback': self.errback,
      })

This page method downloads the file but it's not accessible. I want to save the downloaded file even after the program terminates.

elacuesta commented 5 months ago

I assume the click triggers a download, please try handling the download event with playwright_page_event_handlers

sanjeethboddi commented 5 months ago

Got it 👍