UIelement is no longer Valid Error on Invoke Workflow

Hi All,
I’m hitting an issue when i try to run an automation through invoke work flow file.
I have an automation that clicks inside a search text box then types a name to search. When i run the automation from the original .xaml file it works fine.
I have another automation that logs into the site and then i have an invoke workflow file for search .xaml. This automation logs in without issue, but then when it tried to click inside the search text box, i get the following error:
The UiElement is no longer valid at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Any suggestion on why this search .xaml works fine when running by its self but not when it is invoked?


It may be bcos the type into action u are using is not related to the browser after u make that activity into invoke method try adding attach browser activity and indicate the browser on which the text box where u need to enter text exists and also make sure to import arguments if needed.

Thanks and regards

Thank you for your response! I do have the type action inside an attach browser and all my Arguments are correctly being passed in. I have the Selectors for both the attach browser and Type actions very generic with wildcards. ’
I am confused as to why this happening. When I log in manually and then run my search process, the search works as intended. When I have a separate process log in and then run the search process through invoke, I get the “UI element is not valid error”.

What could change by invoking the workflow?



Try removing the [k(enter] and place a send hotkey activity to do the enter

I had to change the type activity to “simulate type” and then add default Click activity to click the search icon instead of the send hot key. It fixed my issue but i’m still confused as to why this was needed. Anyone from UiPath have an answer?

  • Simulate click function is created to make activities work even if the window on with the automation activities are taking place

  • But when u try to use send hot key and use simulate click it means that u are trying to type into even when the element onto which u wana type is not visible so the bot wont be able to send the hotkey to the screen .

  • so it just takes it as a normal string input.