我正在尝试通过操纵up进行SSO身份验证。登录后,URL重定向到原始页面。登录完成并且页面完全加载后,我想获取页面的内容。我越来越
Execution context was destroyed, most likely because of a navigation
错误。哪个执行上下文被破坏了?重定向后如何获取页面的内容?
/*
Get reponse for a URL
*/
let getPageResponse = async function (url, cookies, timeout) {
try {
let browser = await puppeteer.launch({headless: false});
let page = await browser.newPage();
const response = await page.goto(url, {'timeout': timeout, 'waitUntil': ['load', 'networkidle0']});
let currentUrl = page.url();
await page.type("#uname", secrets.id);
await page.type("#pwd", secrets.password);
let [responseNew] = await Promise.all([
page.waitForNavigation({'timeout': 30000, 'waitUntil': ['load', 'networkidle0']}),
page.click(handleInfo.element),
]);
let content = await page.content();
console.log("<<"+content);
}
catch (e) {
console.log('<<<<< ERROR' + e);
} finally {
}