Rayrun
← Back to Discord Forum

Script run hangs instead of failing when element can't be found

I have been coming across an issue where periodically when a script should fail due to a missing element (in this case it needs to be updated), instead it just hangs indefinitely and does not time out.

Has anyone else encountered this and if so did you find a specific cause or way to resolve?

In this case, navigation to the next page fails, so the element doesn't exist and the next action can't be carried out

The action it hangs trying to carry out

await _employmentStatusComboButton.ClickAsync();

The last thing in the log:

"networkidle" event fired```

I would expect there to be some sort of timeout that would case the script to fail, but instead nothing happens until I manually abort the test.

This thread is trying to answer question "Why does a script hang indefinitely instead of failing when it can't find a required element, and how can this issue be resolved?"

4 replies
mukulbhatt1564

What’s your action timeout settings? You may have higher value

The only wait time I have specifically set is for LocatorAssertionsToBeVisibleOptions which is set for 60000ms

This was sitting for a good ten minutes

dirvinautomation_16636

Are you sure it's not 600_000 ms? 😅 That would be 10 minutes

Try disabling actionability checks they sometimes cause playwright executions to hang in scenarios playwright is unable to complete all the checks. https://playwright.dev/docs/actionability#introduction Code to disable await page.locator('#abc').click({ force: true });

Related Discord Threads

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