pupeteer not able to navigate to a new URL after clicking on button on jenkins

224 Views Asked by At

After clicking on a button puppeteer not navigating to new URL.

console.log(this.page.url);//current URL

await this.utils.click(this.page, '[trackid=navigation_primary_button] :not([disabled])' );

console.log(this.page.url);//current URL // expected new URL

Tried:
awaitPromise.all([this.page.click('[trackid=navigation_primary_button]'),this.page.waitForNavigation()]); Result: Timeout Error navigation timeout

1

There are 1 best solutions below

0
On

Try this

page.setDefaultNavigationTimeout(0) // USE THIS LINE ONLY IF YOU NEED

console.log(this.page.url) //current URL

const pageLoadNewURL = await Promise.all([
    page.waitForNavigation ({ timeout: 0, waitUntil: 'domcontentloaded' }),
    this.utils.click ( this.page, '[trackid=navigation_primary_button]:not([disabled])' )
])

console.log(this.page.url) //current URL // expected new URL