Created
July 16, 2020 18:33
-
-
Save ashutoshpw/827bb2b8c5fc42109753d48292a8d4da to your computer and use it in GitHub Desktop.
puppeteer-chrome
This file contains hidden or 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 p = require('puppeteer'); | |
async function vo(){ | |
const b = await p.launch({args: ['--no-sandbox']}); | |
const page = await b.newPage(); | |
await page.goto("https://www.opinionstage.com/polls/2462945/poll?sembed=1&wid=0"); | |
page.on('console', msg => { | |
for (let i = 0; i < msg.args.length; ++i) | |
console.log(`${i}: ${msg.args[i]}`); | |
}); | |
//await page.waitForNavigation({ waitUntil: "networkidle0" }); | |
await page.evaluate(() => { | |
document.querySelectorAll(".side-box")[2].click(); | |
setTimeout(function(){document.querySelectorAll("a.voting-button")[0].click();},1500); | |
}); | |
setTimeout(function(){b.close()},5000); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment