Rayrun
← Back to Discord Forum

request randomly is not being sent after click action, even though manually it always happens

Hey guys Maybe someone have encountered the same problem. When I'm trying to click on toggle and wait to particular response nothing happens, request is not being sent for some reason. It works in 20% of the runs and actually never passes in a first attempt. What could be an issue? headless or not doesn't matter, result is the same

This thread is trying to answer question "What could be the issue causing the request to not be sent after a click action, and how can it be resolved?"

3 replies
refactoreric

Many apps/pages appear ready when they're not. So Playwright's actionability checks will pass, Playwright will click or enter a field, but the event handlers aren't attached yet, so nothing happens, or even worse, the field value will be overwritten by the app/page initialization.

Something like that should ideally be fixed in the app (show glass pane when loading/processing or disable controls, etc.), but if that's not option we have to add an intelligent wait in the test for some indicator of the page being ready. Like a waitForResponse or waiting for a logout link appearing. What you need to wait for depends on the app and the scenario.

(This would be worth a FAQ article)

@refactoreric the point is that i'm waiting for the requests that potentially could have been sent before clicking on particular element the page is completely rendered etc, but still clicking doesn't trigger request from time to time 😦

refactoreric

Hmm could still be that the page is not ready to proceed.

Have you tried the trace viewer? https://playwright.dev/docs/trace-viewer-intro

I always set the trace option to 'retain-on-failure' because whenever the tests fail, it's much easier to troubleshoot.

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