Handling Selectors Dynamically

Hi

We have an WebApplication that is built using Product Line Engineering with a common (core application) and there are different variants of this application (instances). The core application has the most of the functionalities defined in it and the variants applications (5) are customization’s performed on it.

We are trying to perform UI automation using UiPath and we are in the POC mode right now.

We have the following situation that needs to be handled and would like to know how this can be handled or achieved with UiPath,

The Variants applications have different Login URL for example http://url1 , http://url2, etc
The Variant applications have different Window or HTML Page title for (e.g) Title1, Title etc
The Login page doesn’t have a title

Now the Challenge we are facing are,
The Selector for a given control in the login page is identified like this,

<html app='chrome.exe' url='http:/appurl1/login.aspx' />
<webctrl id='TextLogin' tag='INPUT' />

now for every variant of the application and we don’t want to change the selectors every time before we run the set of workflows we have defined, this is tedious and not user-friendly. Therefore we would like to know how to handle this in UiPath.

Similarly, for the controls in the subsequent pages the selector is as below,
<html app='chrome.exe' title='title1' />
<webctrl tag='A' aaname='New Customer' />

for each variant of the application the title varies and we don’t want to change the selectors every time before we run the set of workflows we have defined, this is tedious and not user-friendly. Therefore we would like to know how to handle this in UiPath.

I tried specifying title=‘’ or url='’ in URL it doesn’t locate the element…

Also how to run multiple instances of the same application simultaneously and how should then the selector be handled dynamically, we would like to handle the selectors dynamically… is there a way?

If every time title is changing, then set title=‘*’ in the selector.

18.4.1+Branch.master.Sha.bc66386dd8e2160b6d35f31d5ce934a5aa4cf4bd

Source: Set Text ‘INPUT TextLogin’ (Set Text ‘INPUT TextLogin’)

Message: Cannot find the UI element corresponding to this selector:
<html app='chrome.exe' url='*' />
<webctrl id='TextLogin' tag='INPUT' />

Exception Type: UiPath.Core.SelectorNotFoundException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Core.SelectorNotFoundException: Cannot find the UI element corresponding to this selector: ----> System.Runtime.InteropServices.COMException: Cannot find the UI element corresponding to this selector:
at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID)
at UiPath.Core.UiElement.FindFirst(FindScope scope, Selector selector)
— End of inner ExceptionDetail stack trace —
at UiPath.Executor.WorkflowRunner.EndExecute(IAsyncResult result)
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)

the above exception is thrown if i use url=*"

‘*’ works for the titles.
Remove the url attribute and try again. I guess url attribute is optional to identify the element.

For example:

<html app=‘chrome.exe’ />
<webctrl id=‘TextLogin’ tag=‘INPUT’ />

it only works if only one instances of chrome is open, in case if the browser is already referring to another website then it doesn’t work.

The solutions I gave by assuming there is only one instance of window is open.
If we have more than one instance, we have to tune the selectors (by omitting some attributes) to uniquely identify the elements with the minimum possible attributes in a selector.

We can make the selectors dynamic, by using regular expressions -
‘*’ - to match anything
‘?’ - to match single character

For example:

<html app=‘chrome.exe’ title=‘title?’ />
<webctrl tag=‘A’ aaname=‘New Customer’ />

<html app=‘chrome.exe’ title=‘tit*’ />
<webctrl tag=‘A’ aaname=‘New Customer’ />

And also by using variables in the selectors -

For example:

<html app=‘chrome.exe’ url=‘" + variableWithURLLINK + "’ />
<webctrl id=‘TextLogin’ tag=‘INPUT’ />

Even, I was thinking to use the variable approach but then how do we parameterize the URL for every instances of my application. As i said earlier the application already has 5 variants for each and every control identification i have to parameterize the “Title” and how to let UI Path runner know that I am now running variant1 or variant2 of my app. So that UI Path can handle this variations for all the controls used in all the workflows irrespective of user intervention? Hope you are able to visualize the challenge we are facing now?

If i try to use variable i am getting the following error
18.4.1+Branch.master.Sha.bc66386dd8e2160b6d35f31d5ce934a5aa4cf4bd
Source: Set Text ‘INPUT TextLogin’ (Set Text ‘INPUT TextLogin’)
Message: Cannot find the UI element corresponding to this selector:

Exception Type: UiPath.Core.SelectorNotFoundException
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Core.SelectorNotFoundException: Cannot find the UI element corresponding to this selector:

System.Runtime.InteropServices.COMException: Cannot find the UI element corresponding to this selector: "html app='chrome.exe' url='" + Url + "' webctrl id='TextLogin' tag='INPUT' /" at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID) at UiPath.Core.UiElement.FindFirst(FindScope scope, Selector selector) --- End of inner ExceptionDetail stack trace --- at UiPath.Executor.WorkflowRunner.EndExecute(IAsyncResult result) at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)

share your exact selector the way you have made it dynamic.

Can somone share a screenshot of this flow, how to use it. I have this same challenge to work on.

I have different URL getting for each search activity on page.

Just chking how to handle this. Thanks!