Andres Urdaneta
Andres Urdaneta

Reputation: 451

Puppeteer timeout of 3000ms exceeded when clicking a button that Filters results

My code:

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}`);
  }
})();

The error:

this is the TimeoutError: Navigation timeout of 30000 ms exceeded

What I'm trying to achieve:

Input a First Name and Last Name in the respective input fields and click the FILTER button. However, when I submit the form by clicking the FILTER button, it gives me the mentioned error above. I don't understand why...

Upvotes: 2

Views: 909

Answers (2)

i-Guru
i-Guru

Reputation: 184

I solved this problem using bellow commands.

page.setDefaultNavigationTimeout(100000);

to set navigation time 10 seconds.

Regards

Upvotes: 2

vsemozhebuty
vsemozhebuty

Reputation: 13782

If I understand it correctly, page.waitForNavigation() concerns URL change, while the filter button just uses AJAX requests and modifies the DOM. You can try page.waitForResponse() and page.waitForSelector() instead.

Upvotes: 1

Related Questions