Last active
November 8, 2023 13:31
-
-
Save fawazahmed0/5a779ddebfb614bf099e1c004c2dacb4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { firefox } = require('playwright'); | |
const path = require('path') | |
const fs = require('fs/promises') | |
async function begin(){ | |
let filename = 'myzip.7z' | |
const browser = await firefox.launch({headless:true}); | |
const page = await browser.newPage(); | |
await page.goto('https://gofile.io/d/bsgS8S'); | |
const downloadPromise = page.waitForEvent('download',{timeout:0}); | |
await page.getByText(filename).click(); | |
const download = await downloadPromise; | |
await fs.rename((await download.path()), path.join(__dirname, filename)) | |
await browser.close(); | |
} | |
begin() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment