Difference between running from cmd or via Robot tray

I’ve written a simple process that opens notepad (which is pinned to my desktop taskbar), types some text (including some passed as an input argument), then assigns some of the text to an output argument.

When I run it from the Robot tray or as a job from Automator everything works fine, however when I run this command instead:

"C:\Program Files (x86)\UiPath\Studio\UiRobot.exe" -file "C:\Users\<user>\Documents\UiPath\MoreComplexProcess\Main.xaml" -input "{'TextFileText':'Hello'}"

I get this error:

MoreComplexProcess: An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Core.SelectorNotFoundException: Cannot find the UI element corresponding to this selector: <wnd cls='MSTaskSwWClass' title='Running applications' /><wnd cls='MSTaskListWClass' title='Running applications' /><ctrl name='Running applications' role='tool bar' /><ctrl automationid='{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\notepad.exe' /> ----> System.Runtime.InteropServices.COMException: Cannot find the UI element corresponding to this selector: <wnd cls='MSTaskSwWClass' title='Running applications' /><wnd cls='MSTaskListWClass' title='Running applications' /><ctrl name='Running applications' role='tool bar' /><ctrl automationid='{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\notepad.exe' />
   at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID)
   at UiPath.Core.UiElement.FindFirst(FindScope scope, Selector selector, IVariableResolver resolver)
   --- End of inner ExceptionDetail stack trace ---
   at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
   at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
   at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Can anyone help? I’m unsure of the difference between running a process using the robot tray or via command line, as far as I’m aware they should be the same thing. I’m using an enterprise 60 day trial license if that helps.

EDIT: Trying the following doesn’t seem to work either, it gives the same error:

"C:\Program Files (x86)\UiPath\Studio\UiRobot.exe" -process MoreComplexProcess -input"{'TextFileText':'Hello'}"

Hi @Jonny_Rogers

Could you share some details about this particular project? What does it do?

It should normally work without an issue.

Hi Jonny,

I met a similar problem recently.

In my case, executions launched from UIRobot or via .bat files can NOT find element at all, while it ran smoothly using UIPath studio (that big green play button on the top).

The sample I ran is just the same one but constantly got Error while using robot tray. I was totally confused :scream: :scream: :scream: and tried to searched through the forum but didn’t find relevant post.

At last, I suddenly realized that it’s probably something with OS permissions. I tried right-click the .bat file (used to run .xaml file with robot.exe) and chose ''Run as administrator" and it finally started working correctly.

Though I did not test, I suppose that if you want to use robot tray, just give the UiRobot.exe application enough OS permission to run the process.

Hope this little sharing could help someone who might encounters same problem.

1 Like