-
-
Save kdzwinel/d853006b0934c9ae3b5852eb964f292c to your computer and use it in GitHub Desktop.
bad.js will fail, good.js will work in 1.11.0
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 function main() { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
// disabling request interception allows page to load | |
await page.setRequestInterception(true); | |
page.on("request", request => request.continue()); | |
try { | |
await page.goto('http://127.0.0.1:8080/test_page.html', { timeout: 5000, waitUntil: 'load' }); | |
// 🐞this never happens in pptr > 1.6.2 (last tested was 1.11.0) | |
console.log('success ✅') | |
} catch (e) { | |
console.log('timeout 🔴'); | |
} | |
await browser.close(); | |
} | |
main(); |
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 function main() { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
const cdpClient = page._client; // reusing same session to be as close to puppeteer implementation as possible | |
await cdpClient.send('Network.setCacheDisabled', {cacheDisabled: true}); | |
await cdpClient.send('Network.setRequestInterception', {patterns: [{urlPattern: '*'}]}); | |
cdpClient.on('Network.requestIntercepted', request => { | |
cdpClient.send('Network.continueInterceptedRequest', {interceptionId: request.interceptionId}); | |
}); | |
try { | |
await page.goto('http://127.0.0.1:8080/test_page.html', { timeout: 5000, waitUntil: 'load' }); | |
console.log('success ✅') | |
} catch (e) { | |
console.log('timeout 🔴'); | |
} | |
await browser.close(); | |
} | |
main(); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<script> | |
document.write('<script src="http://de.ioam.de/tx.io?mg=no&st=toi&cp=%2Ftest%2Froot&oc=%2Froot&sv=in&pt=CP&ps=lin&er=N22&rf=&r2=&ur=example.com%3A8080&xy=1440x900x24&lo=ES%2Fxxx&cb=0012&i2=0012a7493b1041c925c360c56&ep=1569196621&vr=412&id=xi82n4&i3=nocookie&n1=3&dntt=0&lt=1547045974863&ev=&cs=z9zs2b&mo=1">' + '</scr' + 'ipt>'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment