Skip to content

Instantly share code, notes, and snippets.

@potatoqualitee
Created September 3, 2022 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save potatoqualitee/1a5f267696662668ff47885ba5d5f1ab to your computer and use it in GitHub Desktop.
Save potatoqualitee/1a5f267696662668ff47885ba5d5f1ab to your computer and use it in GitHub Desktop.
download-file.js
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({ headless: true, downloadsPath: '' });
const page = await browser.newPage({ acceptDownloads: true });
await page.goto('https://windowsterminalthemes.dev/');
const [download] = await Promise.all([
page.waitForEvent('download'),
page.locator('text=Download .json of themes').click()
]);
await download.saveAs(download.suggestedFilename());
await browser.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment