Skip to content

Instantly share code, notes, and snippets.

@tristansokol
Created August 21, 2018 16:19
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 tristansokol/2c3aebd02a7a4c97ef1d319f50d7b144 to your computer and use it in GitHub Desktop.
Save tristansokol/2c3aebd02a7a4c97ef1d319f50d7b144 to your computer and use it in GitHub Desktop.
const puppeteer = require('puppeteer');
browser = await puppeteer.launch({
headless: true,
slowMo: 80,
});
page = await browser.newPage();
await page.goto('http://example.com');
await page.waitForSelector('#tickets');
await page.hover('#tickets > div.container > div > div > div > h2:nth-child(5) > button > i')
await page.waitFor(2000); //make sure I really want to buy
await Promise.all([
page.waitForNavigation({}),
page.click('#tickets > div.container > div > div > div > h2:nth-child(5) > button > i', {
button: 'left',
delay: 200
})
]);
await page.click('#tito-tickets-form > div.tito-submit-wrapper > button')
await page.waitForSelector('#tito-iframe');
const frame = await page.frames().find(f => f.name() === 'tito-iframe');
await (await frame.$('#registration_name')).type('Taylor', { delay: 100 });
await (await frame.$('#registration_name')).type(' Swift', {});
await (await frame.$('#registration_email')).type('taytay@gmail.com')
browser.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment