Why does the ctrlid format detected by UiPath diff

2019-06-20 05:22发布

问题:

Why does the ctrlid format detected by UiPath Studio differs from the documented format in their XSLT representation?

Currently I am working with UiPath to automate a few workflows.

Environment Details:

  • SAP Client: IDES ECC 6.0 incl. EhP7

  • Host machine: Intel Core i3 CPU with 64 bit - Windows 8 system.

While trying to identify an element in SAPTreeList / SAP's Advanced Treelist it seems UiPath detects the ctrlid in the following formats:

  • <wnd ctrlid='74372104' />
  • <wnd ctrlid='59648' idx='1' />
  • <wnd ctrlid='59648' />
  • <wnd ctrlid='74937216' />
  • <wnd ctrlid='100' title='SAP&apos;s Advanced Treelist' />

Snapshot:

The documentation of CtrlId in msdn.microsoft.com mentions:

  • The value of the CtrlId attribute MUST range from 1 through 255 characters, MUST begin with an alphabetic character, and MUST contain only alphanumeric and underscore characters.

  • The following W3C XML Schema (XMLSCHEMA1) fragment specifies the contents of this element.

    <xsd:element name="CtrlId" type="xsd:string"/>
    

So the ctrlid format detected by UiPath Studio seems to be different from the documented format and specification.

Am I missing something here?

As per the Execution.log in this question:

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":"1.0.0.0","jobId":"e7f88d9e-e485-4eee-8a54-7450771238f3","robotName":"ATECHM_03","machineId":0,"fileName":"Main"}

The error details also contains the following fields:

  • level
  • logType
  • timeStamp
  • fingerprint
  • windowsIdentity
  • machineName
  • processName
  • processVersion
  • jobId
  • robotName
  • machineId
  • fileName

So my question are:

  • Does the ctrlid of an element have any dependency on any of these parameters?
  • Is ctrlid of an element unique to each system?
  • Is ctrlid dynamic within the same jobId?

回答1:

I will try to provide some answers as to how i understood the questions:

  • Does the ctrlid of an element have any dependency on any of these parameters?

    UiPath creates a selector providing some dependencies, which are not always the optimal one, since some of these might change dynamically every time the application runs or another element loads. So yes the element has dependencies on these specific parameters at the time of its creation (when indicated by UiPath) but during the execution these might change, causing the selector to 'hung'

  • Is ctrlid of an element unique to each system?

    Some ctrlid of elements are unique to each system as per your link to CtrlId

The value of this attribute SHOULD be unique for each button control and picture button control in the form.

  • Is ctrlid dynamic within the same jobId?

In other cases the value of ctrlid might be dynamic. In such cases as per your example image (highlighted values):

  1. UiPath best practices suggest to avoid using them when building a stable selector
  2. But if you want to use them, then you need to either use wildcards to make these dynamic (try '*') or retrieve the dynamic value each time and use it within the selector setup (try '+dynamicValue+')
  3. In the end you always need to test your selectors, through trial and error you will enhance your solution.

Hope you will find these information useful.