UI Element Selectors Not Functioning as Expected

The UI Element markup was originally made for Excel 2016, and the User who is running the bot has Excel 2016, yet when the bot is run it throws the following error in regards to the selector:

Error {“message”:“Send Hotkey Alt + hds: Cannot find the UI element corresponding to this selector: ”

I’ve checked the selector in Studio for issues and have not found any. I’ve also checked the selector for differences against an older version of excel (2013) and the markup code was the same. The code is different when it comes to using Office 365 Apps as opposed to the standalone Excel Professional 2016, but that’s not a factor for the user.

Other Details:
When the user runs the bot, it starts as expected. It asks for credentials and other inputs, and proceeds to open the excel file as normal. When it begins to edit it runs into the issue. Of course, this doesn’t happen on my development laptop, and when tested on another machine with an older version of excel it didn’t produce an error and selected the element as normal. I’ve verified with the user that they do in fact have Excel 2016.

This project was handed off to me, and from the documentation and my understanding of how it works, the bot is meant to be used with Excel 2016.

There’s an alternative to replace many selector functions with hotkey combinations, but there’s an extensive list of edits to be done, so that is a less desirable work-around.

Any help?

<wnd app='excel.exe' cls='XLMAIN' title='RAP Reporting Tracker - Excel' /><wnd title='RAP Reporting Tracker' />

Id guess there’s an issue with the window title, that’s generally the issue with selectors like that as the existing one you’re showing is very specific. It also looks like 2 separate “title” attributes are being used as selectors? Not sure why.

Either way, I’d make the title a little more generic by using the * wildcard as appropriate (e.g. *RAP Reporting Tracker* )

Also, if your user has multiple excel windows open with the same title it will not be able to differentiate between them and the robot will fail due to a selector issue

OK, I have taken a look at that before and can give it another try.

I do have places in the edited in the code where the title does have the * by it instead.

The users title does appear to be the same as it should be on the video at least, but I’ll try changing it in the selector.

I’ve noticed this:

Excel 2013/2016: title = ‘title name - Excel ‘

Office 365: title = ‘title name.xlsx - Excel’

I made sure she had all windows closed before running (although there’s workflows in the init function to close all MS office suite apps as well).

It could take a while to see results (as I can change it on my end, but it has to be pushed to the user and tested on their end on their time), but I’ll let you know if that fixes the issue or not.

Also, for the two separate titles it may have been a typo from the previous developers, I’ve removed that from the code.


I have results from the user. It looks like using the wildcard at the end of the title all instances in the selectors helped. The user did run into this error however.


14:56:39.9978 Error {“message”:“Check Create a Copy: Cannot find the UI element corresponding to this selector: ”…


Before that step, the bot begins to copy a sheet of excel using hot keys and the following window is opened.


The create a copy checkbox at the bottom is what it’s having trouble selecting on my user’s machine. It selects it fine on my machine with the same code. Any ideas about this instance? (I’m sure there’ll be more small instances throughout but I just want to at least be able to pin point a recognizable pattern so I can go ahead and make the necessary changes as needed).

As long as the bot is already using hotkeys, why not just continue the trend by using alt+c to check the box? You can use image recognition in an if statement as well to make sure that the box is not checked (not sure if this is needed, I believe it is always going to be unchecked)

Selectors are usually the most reliable way to automate most things, but since you’re having issues and are already using hotkeys anyways, I’d go ahead and make use of them some more. Note that you don’t need to include selectors with the send hotkey activity - if you don’t provide selectors it will just use the hotkey with the currently active window.

Depending on how much automation you’re doing within excel and how complicated it is, you can also write a quick macro to run. This could be as simple as 2-5 lines of code in VBA since it can directly access the objects easier compared to uipath. You can then use the execute macro function to run it

Ok, I can continue to use hotkeys. This bot was passed to our organization from a contracting company who originally built it, and it appears some of the workflows don’t all follow a distinct pattern. The bots functions are moderately complex, but there’s numerous workflows that contain multiple drill down sequences of excel edits. So I was attempting to avoid changing most (or all necessary) selectors for excel edits into hot key shortcuts.

The VBA edit may be a good idea, but the user’s work through a secured networked computer and would need admin rights in order to enable macros on excel (or any other file using it).

Thanks for the help, I’ll go through and try to replace as many selectors with hotkeys as I can and see how it turns out.

Good morning Dave,

I’ve sent off the bot for the user to test after replacing as many selectors with hotkey commands for excel and testing it for accuracy. While awaiting results I do have another question if you don’t mind.

Is there a good way to prevent webpage timeouts during bot manipulation (such as simulating clicks while the bot is processing web information or awaiting a long-running loading screen or web script)?


-The page time outs happen in a somewhat random fashion (not to say that the timeout timer is random, rather the time it takes to process information)

-On certain secure pages, a simulated click does not count as an actual mouse event click and isn’t registered by the webpage

-Each timeout means an immediate bot failure (the workaround is to log out and log back in after each iteration in certain instances – terrible for bot performance and adds to much time to the process)

-Processing times often vary, mostly due to information pulling; less to do with internet connectivity and speed and rarely with any long running scripts.

I think it’s sort of a guess & check situation that would just depend on the webpage itself. If it doesnt require background automation, you can just use the hardware emulation for the click instead which is exactly the same as a user clicking a mouse. Otherwise SendWindowsMessages should work and should still register as a user clicking.

You can play around with other methods of keeping the session active though too. Perhaps activating an object on the page, or using a type into activity, or if the webpage allows it just a simple refresh.

Whichever method you end up using you can do it in a parallel activity and have the “keep session active” side in an endless loop. You might want a 3rd sequence in the parallel activity that is just a delay activity or something similar so it’ll exit out after X amount of time too. Then make sure to check the property so it exits the parallel whenever one side finishes (can’t remember the name of that property offhand).

1 Like


From the original selector issue:

It looks like using the hotkeys has been successful (with the exception of a an error found after gathering a hour’s worth of information, troubleshooting that now). Thanks for the suggestions and feedback.

Yesterday I began implementing the “Keep session active” workflow and it seems like it may work, I’ll know after it’s tested on the user’s machine (my machine processes faster than the users).

Thanks again for your help.

1 Like