I have a website which i want to crawl, where when i submit a form i am opening it into a new page using Command + Click in macOS.
It is working fine and after the submission of the form it is opening in new page, but now the problem arises that how do i get the new page content
console.log('before new page')
const [firsPage] = await Promise.all([
page.waitForNavigation({
timeout: 0
}),
await page.evaluate(() => {
document.addEventListener(
'contextmenu',
(event) => event.stopPropagation(),
true
)
}),
await page.keyboard.down('Meta'),
await page.click('input[type="submit"][name="formsearch"]'),
await page.keyboard.up('Meta'),
])
console.log('after new page')
console.log('First page is ' + firsPage.url())
console.log('Browser page are ' + (await browser.pages()))
Here it outputs
before new page
Thats it does not go forward.It does not return the newpage as well as does not print
console.log('after new page')
console.log('First page is ' + firsPage.url())
console.log('Browser page are ' + (await browser.pages()))