About Article
This article explains a flaky behavior observed in Virtuoso tests when a new browser tab is opened with a delayed JavaScript action. It clarifies the difference between Click and Mouse click actions and describes how adjusting the approach improves test stability.
Problem Statement
In certain test scenarios, using the Click action to open a new tab results in inconsistent behavior. Although Click includes intelligent mechanisms such as automatic tab switching, the newly opened tab is not always detected quickly enough. As a result, the source tab remains selected, causing subsequent steps to fail.
Solution
To resolve the issue, replace the Click action with Mouse click, which performs a direct interaction without additional intelligence. After triggering the Mouse click, explicitly switch to the newly opened tab.
Additionally, replace static waits (for example, a fixed 15-second delay) with a dynamic wait for a reliable element, such as an iframe that is present in the opened tab. This ensures the test proceeds only after the new tab is fully loaded.
Comments
0 comments
Please sign in to leave a comment.