Add ability to run JS scripts during archiving with Playwright/Puppeteer
See original GitHub issuehttps://github.com/GoogleChrome/puppeteer is fantastic for scripting actions on pages before making a screenshot or PDF.
I could add support for custom puppeteer scripts for certain urls that need a user action to be performed before archiving (e.g. logging in or closing a welcome message popup).
Puppeteer code looks like this:
const browser = await puppeteer.launch({headless: false})
const page = await browser.newPage()
await page.goto('https://carbon.now.sh')
const code_input = 'div.ReactCodeMirror div.CodeMirror-code > pre:nth-child(11)'
await page.click(code_input)
await page.keyboard.down('Meta')
await page.keyboard.down('a')
await page.keyboard.up('a')
await page.keyboard.up('Meta')
await page.keyboard.press('Backspace')
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:16 (13 by maintainers)
Top Results From Across the Web
Debugging Puppeteer & Playwright scripts | by Giovanni Rago
Another way to better observe our script's execution is to run in headful mode: For Playwright: ... DEBUG="puppeteer:*" node script.js ...
Read more >Write your own E2E Test Scripts for Playwright & Puppeteer
Fast forward to today, I'm writing up this guide on a few tricks I wish I knew at the time, to quickly craft...
Read more >Running End-to-End Tests with Playwright on AWS Lambda
I created a simple Node.js function that uses Playwright to open Google search frontpage and print the page title to console. You can...
Read more >Scraping the web with Playwright | ScrapingBee
Headless browsers solve this problem by executing the Javascript code, ... Setting this to true will run Playwright in headless mode.
Read more >Puppeteer | Puppeteer
Puppeteer is a Node.js library which provides a high-level API to control Chrome/Chromium over the DevTools Protocol. Puppeteer runs in headless mode by ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
archive.is has a nice set of scripts that do things like expanding all Reddit threads or scrolling through Twitter timelines before taking a snapshot. This is the kind of thing I’ve seen develop a nice community around with youtube-dl.
Not yet but soon! It’s just in a gist right now. Will publish it once I’ve moved >50% of the old codebase into the new structure. I’m traveling in Mexico right now with limited work time but will keep everyone posted as it progresses!
The new design is quite exciting, I’m able to add new features as plugins with <10min of boilerplate work per feature.
https://gist.github.com/pirate/7193ab54557b051aa1e3a83191b69793