UNPKG

puppeteer-extra-plugin-stealth

Version:

Stealth mode: Applies various techniques to make detection of headless puppeteer harder.

25 lines (19 loc) 509 B
'use strict' const PuppeteerExtraPlugin = require('puppeteer-extra-plugin') /** * Pass the Chrome Test. * * Could be mocked further. */ class Plugin extends PuppeteerExtraPlugin { constructor (opts = { }) { super(opts) } get name () { return 'stealth/evasions/chrome.runtime' } async onPageCreated (page) { await page.evaluateOnNewDocument(() => { window.chrome = { runtime: {} } }) } } module.exports = function (pluginConfig) { return new Plugin(pluginConfig) }