{ const browser = await puppeteer.launch({ headless:false, slowMo:100, // it helps to add some delay between navigation. args:["--window-size=1920,1080"] }) const page = await browser.newPage() await page.setViewport({width:1720, height:1080}) //you can adjust the width and height . await page.goto("https://google.com") const coursesPageLink = ".menu > li:nth-child(3) > a" await page.waitForSelector(coursesPageLink) // it will wait here until load that specific selector. await page.click(coursesPageLink) const enrollButton = ".bg-success-btn" await page.waitForSelector(enrollButton) await page.click(enrollButton) await browser.close() //close the browser. })()"> { const browser = await puppeteer.launch({ headless:false, slowMo:100, // it helps to add some delay between navigation. args:["--window-size=1920,1080"] }) const page = await browser.newPage() await page.setViewport({width:1720, height:1080}) //you can adjust the width and height . await page.goto("https://google.com") const coursesPageLink = ".menu > li:nth-child(3) > a" await page.waitForSelector(coursesPageLink) // it will wait here until load that specific selector. await page.click(coursesPageLink) const enrollButton = ".bg-success-btn" await page.waitForSelector(enrollButton) await page.click(enrollButton) await browser.close() //close the browser. })()"> { const browser = await puppeteer.launch({ headless:false, slowMo:100, // it helps to add some delay between navigation. args:["--window-size=1920,1080"] }) const page = await browser.newPage() await page.setViewport({width:1720, height:1080}) //you can adjust the width and height . await page.goto("https://google.com") const coursesPageLink = ".menu > li:nth-child(3) > a" await page.waitForSelector(coursesPageLink) // it will wait here until load that specific selector. await page.click(coursesPageLink) const enrollButton = ".bg-success-btn" await page.waitForSelector(enrollButton) await page.click(enrollButton) await browser.close() //close the browser. })()">
const puppeteer = require("puppeteer")
(async()=>{
const browser = await puppeteer.launch({
headless:false,
slowMo:100, // it helps to add some delay between navigation.
args:["--window-size=1920,1080"]
})
const page = await browser.newPage()
await page.setViewport({width:1720, height:1080}) //you can adjust the width and height
.
await page.goto("<https://google.com>")
const coursesPageLink = ".menu > li:nth-child(3) > a"
await page.waitForSelector(coursesPageLink) // it will wait here until load that specific selector.
await page.click(coursesPageLink)
const enrollButton = ".bg-success-btn"
await page.waitForSelector(enrollButton)
await page.click(enrollButton)
await browser.close() //close the browser.
})()