Rayrun
← Back to Discord Forum

Which timeout setting do API requests use?

MarkusAtWörkposted in #help-playwright
Open in Discord
MarkusAtWörk

Hi everyone, which timeout setting applies to API requests? E.g. request.get(...) Is it actionTimeout or navigationTimeout?

This thread is trying to answer question "Which timeout setting do API requests use?"

7 replies

Hi, I assume nor actionTimeout neither navigationTimeout. Timeout option is passed in the obje as a second parameter

const getRequest = async (page: Page) => page.request.get('https://url.com', { timeout: 3 * 1000 });
MarkusAtWörk

Hmm, I assumed one of them would apply 🤔 As I can also add a separate timeout to page.goto('https://google.com', { timeout: 10 * 1000 }) but the navigationTimeout settings value is used if I don't.

I see, based on documentation https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout the navigationTimeout is applied to the following methods page.goBack() page.goForward() page.goto() page.reload() page.setContent() page.waitForNavigation() page.waitForURL()

This page about request.get() https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get I assume there is no global option to set a timeout for this method, only as a parameter in the object BTW, it's set to 30 seconds by default

MarkusAtWörk

Aha, that helps, thanks 😄

MarkusAtWörk

I experimented a bit and it seems it is indeed affected by the actionTimeout setting even though the docs don't mention it.

MarkusAtWörk
image.png
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 [email protected].