Created
November 6, 2019 05:12
-
-
Save codesorter2015/d40b9d5902e2c4fd14c81fb5c737db5a to your computer and use it in GitHub Desktop.
Add script via page.addScriptTag (puppeteer)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.isInjected = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment