How to construct a selector based on dynamic ctrlid through UiPath?

This question have a reference to the following questions:

I am following the video SAP Automation with UiPath to automate logging in through the SAP client as a user with valid credentials. Following the video I have a Attach Window activity which contains two activities as follows:

  • A Click Text of ClickType as CLICK_SINGLE
  • A Click Text of ClickType as CLICK_DOUBLE

The elements as identified by Selector Editor or UI Explorer are as follows:

<wnd ctrlid='76836616' />
<wnd ctrlid='100' title='SAP&apos;s Advanced Treelist' />


<wnd ctrlid='76836616' />
<wnd ctrlid='5002' title='myContainer' />
<wnd ctrlid='1008' />
<ctrl name='SAP_IDES' role='list item' />

As you can observe the ctrlid is same for both the elements but some how it is dynamic. So the first couple of execution is perfecto.

The issue starts when trying to execute the workflow after a considerble amount of time have elapsed. I was facing an error as:

Error {"message":"Click Text 'SAPTreeList': Cannot find the UI element corresponding to this selector: <wnd ctrlid='90279688' /><wnd ctrlid='100' title='SAP&apos;s Advanced Treelist' />","level":"Error","logType":"Default","timeStamp":"2019-02-06T13:16:44.295729+05:30","fingerprint":"bec67d2a-14d1-4b93-ac06-03156aea69fe","windowsIdentity":"AtechM-03\\AtechM_03","machineName":"ATECHM-03","processName":"LearningUiPath","processVersion":"","jobId":"e7f88d9e-e485-4eee-8a54-7450771238f3","robotName":"ATECHM_03","machineId":0,"fileName":"Main"}

So it was clear from the error message that the selector wasn’t a valid selector.

Using Selector Editor and UI Explorer I found the ctrlid changes from '76836616' to '79865432'. So I tried to use partial selector. It is observed that UiPath randomly:

  • Identifies the element omiting but on execution shows error as:

      Error {"message":"Click Text 'SAPTreeList': Cannot find the UI element corresponding to this selector: <wnd omit:ctrlid='76836616' /><wnd ctrlid='100' title='SAP&apos;s Advanced Treelist' />","level":"Error","logType":"Default","timeStamp":"2019-02-27T11:59:39.2811258+05:30","fingerprint":"752fe27b-16f4-4e7b-95c0-f1e8a6b49e7b","windowsIdentity":"AtechM-03\\AtechM_03","machineName":"ATECHM-03","processName":"LearningUiPath","processVersion":"","jobId":"b6ba7310-749c-4c28-a9d3-d1db0c6c7dec","robotName":"ATECHM_03","machineId":0,"fileName":"SAP_UserList_BOT"}
  • Identifies the element with partial selector as . This works for 4-5 rounds of execution. But then '76836616' also changes to '88068312' where the execution fails.

So my question is how do I accomodate the dynamic ctrlid which changes time to time and is a mandatory selector for UiPath?

Hi @debanjan,

I would suggest you to use Get attribute activity & get the dynamic Ctrl id everytime, and pass the same ctrl id to the given selector dynamically.

I hope this should work.


1 Like