UiPath Web Automation: Workflow Fails on First Run but Succeeds on Second Attempt

Hi everyone,

I’m facing a strange issue in UiPath Studio when automating a web application. Here’s what’s happening:

  • On the first run, the automation fails — usually with a selector issue, element not found, or timeout.
  • When I run the exact same workflow again immediately, it works perfectly.

No changes are made between the two runs. This happens consistently.

Hey @vpansare,

Initial failures followed by success often point to timing or element recognition issues. Check if the application is fully loaded before the robot interacts with it; sometimes a small delay is all it takes. Also, review your UI element selectors. If they’re too specific or rely on volatile attributes, they might not identify the element consistently on the first try. Refining these selectors to be more robust or using alternative identification methods can resolve this. Finally, consider environmental stability—ensure the target application behaves predictably across runs.

Let me know if you need anything more

@vpansare,

Check the selectors of the activity is failing. What’s the error do you get?

@vpansare

Can you show some screenshot of error and which activity is failing and the selector of it please

cheers

Hey! This is a pretty common issue in web automation with UiPath — it usually comes down to timing or page load behavior.

On the first run, the page or specific elements might not be fully loaded or rendered when UiPath tries to interact with them, causing selector or timeout errors. When you run it a second time, the page is often cached or loaded more quickly, so it works.

Fixes to try:

  • Add a “Delay” or use “Element Exists” or “Wait Element Appear” before key actions.
  • Use dynamic selectors or wildcards if elements are changing between runs.
  • Make sure the browser window is in focus and not minimized when running.

Basically, it’s likely a race condition — the robot is just faster than the page. Slowing it down a bit or waiting more reliably should solve it.

Let me know if you want help adjusting your selector or wait strategy!

  1. Set WaitForReady to Complete
    Ensures the page is fully loaded before interacting with elements.
  2. Use Element Exists or Check App State
    Verifies the element is present before performing actions.
  3. Add a Short Delay (2–3 seconds)
    Helps handle slow page loads or browser initialization.
    4.Use Retry Scope
    Retries the action until the element is found or timeout is reached.
  4. Improve Selectors with UiExplorer
    Avoid dynamic attributes like changing id; use wildcards or anchors.
  5. Switch to Modern UI Automation