Closed sick-pupil closed 1 year ago
async def parse(self, response):
page = response.meta['playwright_page']
for headline in await page.locator("//div[contains(@class, 'headline') and contains(@class, 'clearfix')]").all():
await headline.scroll_into_view_if_needed()
await page.wait_for_timeout(2000)
logging.info(await page.content())
with open(file = os.path.join(self.screenshot_path, 'anime', '{}_{}_screenshot.html'.format('anime', self.current_timestamp)), mode = 'w', encoding = 'utf-8') as f:
f.write(await page.content())
selector = Selector(response = page.content())
...
How to config the nested methods into Request(url=..., meta={'playwright_page_methods': [...]})