native-file-system-api-js

Overriding showOpenFilePicker with Puppeteer

蹲街弑〆低调 提交于 2021-01-24 09:54:18
问题 As illustrated in here here, Puppeteer allows to override Javascript functions. I want to override showOpenFilePicker function. That is, when the showOpenFilePicker invoked by the web page. I want to run another function before the showOpenFilePicker. const puppeteer = require("puppeteer"); (async () => { const browser = await puppeteer.launch({ headless: false }); const page = await browser.newPage(); await page.evaluateOnNewDocument(() => { Object.defineProperty(HTMLCanvasElement.prototype,

Overriding showOpenFilePicker with Puppeteer

懵懂的女人 提交于 2021-01-24 09:54:13
问题 As illustrated in here here, Puppeteer allows to override Javascript functions. I want to override showOpenFilePicker function. That is, when the showOpenFilePicker invoked by the web page. I want to run another function before the showOpenFilePicker. const puppeteer = require("puppeteer"); (async () => { const browser = await puppeteer.launch({ headless: false }); const page = await browser.newPage(); await page.evaluateOnNewDocument(() => { Object.defineProperty(HTMLCanvasElement.prototype,

Overriding showOpenFilePicker with Puppeteer

萝らか妹 提交于 2021-01-24 09:53:58
问题 As illustrated in here here, Puppeteer allows to override Javascript functions. I want to override showOpenFilePicker function. That is, when the showOpenFilePicker invoked by the web page. I want to run another function before the showOpenFilePicker. const puppeteer = require("puppeteer"); (async () => { const browser = await puppeteer.launch({ headless: false }); const page = await browser.newPage(); await page.evaluateOnNewDocument(() => { Object.defineProperty(HTMLCanvasElement.prototype,