Answers for "puppeter example fileupload"

0

puppeter example fileupload

const puppeteer = require('puppeteer')
const path = require('path')
const fs = require('fs')
const pathFile = __dirname.split('\\').slice(0, 4).join('/')
const fileExitst = fs.existsSync(`${pathFile}/travis_1.png`)

const scraperRunner = async () => {
	const browser = await puppeteer.launch({ headless: false, args: ['--no-sanbox'] })
	const page = await browser.newPage()
	await page.goto('https://anonfiles.com', { waitUntil: 'networkidle2' })

	await page.waitForSelector('input[type="file"]')
	const input = await page.$('input[type="file"]')
	if (fileExitst) {
		await input.uploadFile(`${pathFile}/travis_1.png`)
	}
}

scraperRunner()
Posted by: Guest on December-29-2020

Code answers related to "puppeter example fileupload"

Code answers related to "Javascript"

Browse Popular Code Answers by Language