← Back to Discord Forum

setDefaultNavigationTimeout not working

Please refer to this timeout error, which occurs almost immediately instead of after 150 seconds.

Error: page.goto: net::ERR_CONNECTION_REFUSED at http://localhost:4200/
Call log:
  - navigating to "http://localhost:4200/", waiting until "load"

   at ..\playwright-global-setup.ts:43

  41 |     // increase wait for navigation to make sure no timeout before webserver started
  42 |     page.setDefaultNavigationTimeout(150000);
> 43 |     await page.goto(config.projects[0].use.baseURL);

This thread is trying to answer question "Why does setDefaultNavigationTimeout not delay the timeout error for the specified duration when encountering a 'connection refused' error?"

4 replies

Note that we start the application not via webserver, but with external http-server command before starting the test

I don't know the answer to this - but I wonder if the timeout only comes into play if Playwright is actually sat waiting for a response?

In this case, it seems like there is an active 'response' (of connection refused), and therefore perhaps as soon as it gets that it doesn't need to wait any longer?

Perhaps instead you may be able to use toPass() in order to retry the navigation until it's successful?


yeah true, the refused connection is probably a final state that stops the wait

good catch, thanks

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.