// This method mouse clicks an element like a human will
async function clickHabbit(page, element) {
try {
const dim = await element.boundingBox()
let x = dim.x + (dim.width / 2);
let y = dim.y + (dim.height / 2);
await sleep(1000);
await page.mouse.move(x, y)
await page.keyboard.down("Meta")
await sleep(1000);
await page.mouse.click(x, y, { button: "left" })
await sleep(1000);
await page.keyboard.up("Meta")
console.log("Element clicked")
} catch (e) {
console.log(e)
}
}
await page.goto("https://yellonaija.com", { waitUntil: 'domcontentloaded', setTimeout: 0 }
const element = await page.$('.active > .vce-grid-item > .vce-grid-text > .vce-featured-info > .vce-featured-section > .category-2')
await clickHabbit(page, element) //Opens a click overlay
const popup = await page.$('#dismiss-button')
await waitFor(2000);
await clickHabbit(page, popup) //Click on the close selector
I am trying to scrap a blog site which has google ads displayed all over and each time i mouse click on any element in the site in raises a click overlay and puppeteer gets stuck. Please i need help exiting this overlay or interacting with the overlay.enter image description here