Skip to content

Instantly share code, notes, and snippets.

@fawazahmed0
Last active November 8, 2023 13:31
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 fawazahmed0/5a779ddebfb614bf099e1c004c2dacb4 to your computer and use it in GitHub Desktop.
Save fawazahmed0/5a779ddebfb614bf099e1c004c2dacb4 to your computer and use it in GitHub Desktop.
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