单击按钮后,操纵up的人便不会导航到新的URL。
console.log(this.page.url); //当前URL
等待this.utils.click(this.page,'[trackid = navigation_primary_button]:not([disabled])');
console.log(this.page.url); //当前URL //预期的新URL
尝试:
awaitPromise.all([this.page.click('[trackid = navigation_primary_button]'),this.page.waitForNavigation()]);
结果:超时错误导航超时
答案 0 :(得分:0)
尝试一下
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