I am scraping a table and each row has a button to show a modal with information. I need to scraping the information from the modal for each row but I dont know how to open the modal. I have tried with page.click(selector) inside page.evaluate() but It didnt work.
I have tested the next code.
const users = await page.evaluate(() => {
const usersTable = Array.from(document.querySelectorAll('table#grilla > tbody > tr'))
const userInfo = usersTable.map(async userTable => {
await page.click('td > a#modificar-2')
await page.click('div > button[type=submit].close')
const username = userTable.children[2].innerText
const firstName = userTable.children[4].innerText
const lastName = userTable.children[5].innerText
const email = userTable.children[6].innerText
const estado = userTable.children[7].innerText
const fullName = firstName + lastName
return { username, fullName, email, estado }
})
return userInfo
})
I dont know how to pass page.click() or another option inside page.evaluate()