Skip to content

Instantly share code, notes, and snippets.

@ashutoshpw
Created July 16, 2020 18:33
Show Gist options
  • Save ashutoshpw/827bb2b8c5fc42109753d48292a8d4da to your computer and use it in GitHub Desktop.
Save ashutoshpw/827bb2b8c5fc42109753d48292a8d4da to your computer and use it in GitHub Desktop.
puppeteer-chrome
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