Rayrun
← Back to Discord Forum

waitForURL() timeout is not working

Linhtinh603posted in #help-playwright
Open in Discord
Linhtinh603
Linhtinh603

I set timeout parameter for waitForURL() function, but the timeout show on error still 30s instead of 60s

image.png

This thread is trying to answer question "Why is the timeout for waitForURL() function not working as expected?"

4 replies

The error is for test timeout. RTFM link : https://playwright.dev/docs/test-timeouts

You can change test timeout in config...

import { defineConfig } from '@playwright/test';

export default defineConfig({
  timeout: 60_000,
});

or, in your test file...

test.setTimeout(60_000);
Linhtinh603
Linhtinh603
@shivaguy: Thank you, btw can you explain the difference of timeout param in waitForURL() and timeout in defineConfig?

Thank you, btw can you explain the difference of timeout param in waitForURL() and timeout in defineConfig?

defineConfig({ timeout }) is the test timeout, that is, if your test doesn't complete within the given time limit, Playwright throws. waitForURL({ timeout }) is the timeout for that particular call of waitForURL, that is, if URL is not reached within the specified time limit, Playwright throws.

Linhtinh603
Linhtinh603
@shivaguy: Yeah. I got it. It means timeout of a wait function always must less than or equal the test timeout (by default is 30000ms). Thanks for your explaination.

Yeah. I got it. It means timeout of a wait function always must less than or equal the test timeout (by default is 30000ms). Thanks for your explaination.

TwitterGitHubLinkedIn
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.