We all deal with the selector in UiPath. Some other vendors also use this to identify elements on the screen. But I would like to read about the technology itself. Does someone know where I could read about it?
I would like to understand the principles of generating selectors, why the code is like this, why some elements do have their own selectors and why some don’t, why some have indexes and why some don’t. Selectors in the Studio are the final product which we see but I would like to understand what stands behind it. If someone has an idea where to read and to learn about it I would be grateful to know it.
This is an interesting question.
I think selectors just naturally were created from many years of website source code evolution. The values in a selector can all be accessed by multiple languages before Macro and RPA tools were being developed. Like in VB, you could get all the elements in the
<a> tag then loop through until you find the link you want and perform a click on it, and this was all done in raw code.
So from my understanding, the selectors come directly from the source code of the website. Every site can be different, so some selectors have attributes that other selectors might not. And, for that reason, sometimes it is challenging to interact with some websites when their source is not done well.
If you were to right click on a website and choose “Inspect” Source or Element, you will see what I am talking about; this also allows you to select individual elements similar to UiPath and take a look at the attributes or tags associated with the element.
But, I’m no expert.
@ClaytonM Thank you for the answer. Theoretically I could imagine the nature of selectors when we talk about websites yeah. But what technology is used when we deal with desktop applications? That’s what really grabs my attention. What contributes to a selector look? Why does a selector can possibly change after an app has been updated? I’m talking about non-internet\non-web apps. Something definitely should be behind it, it’s hardly about magic.
In the early days of macro scripting, we were relying more on mouse coordinates and keystrokes to navigate applications. At some point, it became reliable where the application nodes were accessible and contained attributes which could be used to directly interact with the element.
This is not a very good source, but briefly talks about selectors at the beginning: https://studio.uipath.com/docs/about-selectors
I don’t know much about how the nodes are translated from the source to selectors other than they are accessible.
@ClaytonM Yes, I know the link but the final facts are written there. There written ‘what’ but not ‘why’.
You’re talking about the nodes. But how do the nodes appear? What defines the amount of nodes? I know nothing about its origin. I suppose it’s connected with a graphical part of an application. Say, you are developing an application and creating a form at some point. This form has its, say, ‘back’-code - programming lines defining the behavior of the form. And this form has its, say, ‘front’-code - something that defines its appearance\design\look. I suppose this is where a selector has its roots meaning it comes from the graphical part of the form. But I may be wrong. It definitely needs some literature to look through.
I’m thinking it’s built in with Windows UI. But, like I said I probably know just as much as you do.
I found some info about a tool provided by Microsoft called “Inspect.exe” that may help display where it’s coming from.
I have not tried to install this, and have not played around with this.
@ClaytonM Thank you. I’ll probably try to install it and have some fun with it
Hi, is there anything you found out? I came across this and also are interested…