question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add ability to run JS scripts during archiving with Playwright/Puppeteer

See original GitHub issue

https://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:open
  • Created 6 years ago
  • Reactions:3
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

4reactions
FiloSottilecommented, Dec 1, 2018

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.

3reactions
piratecommented, Jan 8, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found