Created
February 9, 2018 11:01
-
-
Save m-rousse/9330319d662ccc05fdb1d630b3f318ce to your computer and use it in GitHub Desktop.
Proof of bug chrome 65
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 CDP = require('chrome-remote-interface'); | |
async function wait(duration) { | |
process.stdout.write('Waiting ' + duration + ' ms ') | |
await new Promise(resolve => setTimeout(resolve, duration)) | |
console.log('- done!') | |
} | |
CDP(async (client) => { | |
const {Page, Debugger, Runtime, Console, Network, Log} = client; | |
process.on('SIGINT', function () { | |
console.log('CTRL+C'); | |
client.close() | |
process.exit(0) | |
}); | |
try { | |
await Page.enable(); | |
await Debugger.enable() | |
await Debugger.setPauseOnExceptions({"state":"uncaught"}) | |
await Debugger.paused(async () => { | |
console.log("Paused"); | |
await Debugger.resume() | |
console.log('Resumed') | |
}) | |
await Runtime.enable() | |
await Log.enable() | |
await Page.navigate({url: 'http://group.loccitane.com/investors/financial-information?field_type_fi_value=All&field_fiscal_year_taxonomy_target_id=All&page=0'}); | |
await Page.loadEventFired(); | |
console.log("Page 1 loaded"); | |
await wait(1000) | |
await Runtime.evaluate({expression: 'document.querySelector("li.pager__item.is-active > a").dispatchEvent(new MouseEvent("click"))', awaitPromise: true}) | |
await wait(1000) | |
await Runtime.evaluate({expression: 'console.error("All good")'}) | |
} catch (err) { | |
console.error(err); | |
} finally { | |
client.close(); | |
} | |
}).on('error', (err) => { | |
console.error(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment