How do UIPath selectors work when there is no specific ID

时间:2018-11-19 15:52:59

标签: uipath

I am trying to create a UIPath project to automate filling out a simple form in Microsoft Dynamics Web Client 2016. I have been running into problems with strange behavior due to what I believe to be unreliable selectors. The Dynamics web client is written with Angular and seems to be a single page application. None of the inputs have any type of ID or specific data-attribute that UIPath can use as a selector as far as I can tell. It looks like the program is using the DOM tree to count the number of nested divs in order to assign each input with a "parentId" attribute. This seems to cause unreliable behavior when there are popup windows and I am worried that going forward with an automation with this particular web application will not be scalable.

Example of a selector:

<html title="Microsoft Dynamics GP" />
<webctrl parentid='a000000000000000056800083584c00030100000000f1550000000000'
tag='INPUT' />

Where are this selector and parentId attribute coming from and will it be reliable and scalable through updates and form changes?

Example of selector

1 个答案:

答案 0 :(得分:1)

如果无法可靠地找到元素本身,只需在可能的元素上使用锚点来解决该问题。例如,http://www.rpachallenge.com/上的input元素永远不会可靠地找到,因为它们的ID每隔几分钟改变一次。因此,如果您需要在“公司名称”字段中键入文本,则需要使用锚点-在我们的情况下,始终会有带有独特文本的标签。

relative selector with anchor

您将需要使用Anchor BaseFind Element活动(加上所需的操作)。这是锚点的选择器-使用元素的描述性文本:

<webctrl aaname='Company Name' tag='LABEL' />

然后,Type Into活动仅引用了Input元素:

<webctrl tag='INPUT' />

唯一要记住的是多种语言,在这种情况下,您将需要在选择器中考虑它们,或者在适用的情况下通过id选择元素。