Skip to content

Instantly share code, notes, and snippets.

@codesorter2015
Created November 6, 2019 05:12
Show Gist options
  • Save codesorter2015/d40b9d5902e2c4fd14c81fb5c737db5a to your computer and use it in GitHub Desktop.
Save codesorter2015/d40b9d5902e2c4fd14c81fb5c737db5a to your computer and use it in GitHub Desktop.
Add script via page.addScriptTag (puppeteer)
const puppeteer = require('puppeteer');
(async () => {
try {
const browser = await puppeteer.launch({
headless: false,
})
const page = await browser.newPage();
await page.setBypassCSP(true);
await page.goto('https://github.com/google');
await page.addScriptTag({
path: './krish.js'
});
// await browser.close()
} catch (error) {
console.log('error', error)
}
})()
window.isInjected = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment