Created
October 27, 2018 05:23
-
-
Save klogic/6f3196f5bb5e8b463ebcac34535f84ab to your computer and use it in GitHub Desktop.
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
(async () => { | |
const browser = await puppeteer.launch({headless: false}); | |
const page = await browser.newPage(); | |
await page.setViewport({ width: 1200, height: 926 }); | |
await page.goto('https://www.youtube.com'); | |
await page | |
.waitForSelector('#search') | |
.then((selector)=> selector.type('cat vs cucumber')) | |
.then(()=> page.click('#search-icon-legacy')); | |
await page.waitFor(1000); | |
const search = await page.url(); | |
await page.goto(search); | |
await page | |
.waitForSelector('#video-title') | |
.then(() => page.click('#video-title')) | |
// browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment