Skip to content

Conversation

@google-labs-jules
Copy link

This change improves the stability of the Selenium automation framework by addressing common causes of flaky tests.

Key changes:

  1. Robust waitForPageLoaded: Wrapped the initial JS check in a try-catch block to prevent unchecked exceptions from crashing the test flow when the driver is in an unstable state.
  2. Retry Mechanism: Added a retry loop (3 attempts) to clickElement and setText methods. This automatically recovers from StaleElementReferenceException (common in dynamic apps) and ElementClickInterceptedException (common with overlays/spinners).
  3. Wait Optimization: Replaced several hardcoded sleep(3) calls with waitForPageLoaded() or reduced sleep times where explicit waits weren't fully applicable but a shorter delay suffices.
  4. Upload & Verification: Reduced sleep times in file upload and download verification methods to speed up execution.

These changes aim to make the WebUI utility class more resilient to timing issues and dynamic DOM updates.


PR created automatically by Jules for task 14217734582414245073 started by @anhtester

- Refactor `waitForPageLoaded` to handle exceptions during JS execution more safely.
- Implement retry logic in `clickElement` and `setText` to handle `StaleElementReferenceException` and `ElementClickInterceptedException`.
- Reduce hardcoded `sleep` durations and replace with `waitForPageLoaded` where appropriate.
- Optimize `uploadFileWithLocalForm` and file verification methods.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant