我的代码:
const puppeteer = require("puppeteer");
(async () => {
try {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://www.genglobal.org/member-directory");
await page.type("#edit-field-first-name-value", "Abbas");
await page.type("#edit-field-last-name-value", "AL ASMAR");
await page.click(".agree-button.eu-cookie-compliance-secondary-button");
const [submitSearch] = await Promise.all([
page.waitForNavigation(),
page.click("#edit-submit-member-directory"),
]);
await page.screenshot({ path: "screenshot.png" });
await browser.close();
} catch (error) {
console.log(`this is the ${error}`);
}
})();
错误:
this is the TimeoutError: Navigation timeout of 30000 ms exceeded
我想要实现的目标:
在相应的输入字段中输入名字和姓氏,然后单击“过滤”按钮。但是,当我通过单击“过滤”按钮提交表单时,它给出了上面提到的错误。我不明白为什么...
最佳答案
我使用以下命令解决了这个问题。
page.setDefaultNavigationTimeout(100000);
将导航时间设置为 10 秒。
问候
关于javascript - 单击筛选结果的按钮时,Puppeteer 超时超过 3000 毫秒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61560265/