parvinder21
New Coder
JavaScript:
const automation = require("puppeteer");
const fs = require("fs");
const automationConfiguration = {
headless: false
}
async function runautomation() {
const browser = await automation.launch(automationConfiguration)
const page = await browser.newPage()
const navigationPromise = page.waitForNavigation()
await navigationPromise
await page.goto('https://www.google.com/search?q=perfmatters+vs+wp+rocket&oq=perf&aqs=chrome.0.69i59j69i57j0i67j46i433i512j0i433i512l2j0i131i433i512j69i64.961j0j15&sourceid=chrome&ie=UTF-8')
await page.setViewport({ width: 1366, height: 657 })
await page.waitForSelector('.MjjYud:nth-child(5) > .g > .kvH3mc > .Z26q7c > .yuRUbf > a > .LC20lb')
await page.click('.MjjYud:nth-child(5) > .g > .kvH3mc > .Z26q7c > .yuRUbf > a > .LC20lb')
await navigationPromise
await browser.close() }
runautomation()