Skip to content

Instantly share code, notes, and snippets.

@courtneymyers
Created May 30, 2019 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save courtneymyers/0d2e00e95276c7063c1b222fe74c019e to your computer and use it in GitHub Desktop.
Save courtneymyers/0d2e00e95276c7063c1b222fe74c019e to your computer and use it in GitHub Desktop.
Puppeteer
// https://www.youtube.com/watch?time_continue=24&v=YSni7t2ktMA
const puppeteerChrome = require('puppeteer');
const puppeteerFirefox = require('puppeteer-firefox');
(async function() {
try {
async function test(browser) {
const page = await browser.newPage();
await page.goto('https://reactjs.org/');
const search = await page.waitForSelector('#algolia-doc-search');
await search.type('hooks');
await page.waitFor(2000);
browser.close();
};
const chrome = await puppeteerChrome.launch({ headless: false });
await test(chrome);
const firefox = await puppeteerFirefox.launch({ headless: false });
await test(firefox);
} catch(error) {
console.log(error);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment