Created
September 3, 2022 01:43
-
-
Save potatoqualitee/1a5f267696662668ff47885ba5d5f1ab to your computer and use it in GitHub Desktop.
download-file.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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