Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Highlighted
PallaviKR Absent Member.
Absent Member.
3985 views

Element Identification when id are not unique

We are seeing a problem where the ID of the elements are dynamic and keeps changing when launched afresh. How can this be handled using Silk Mobile?

0 Likes
6 Replies
Micro Focus Expert
Micro Focus Expert

RE: Element Identification when id are not unique

Hi PallaviKR

If you controls do not have a unique ID or property which can be used to identify, there are two possible ways you can workaround this.

1. You can extract the control and add it to your element repository and using the IMAGE property to interact with the device.

2. You can construct a unique xpath locator using parent elements of the control you wish to interact with. This may not be possible if you do not have a unique parent or property which you can use to identify the control.

Regards,

Colin

0 Likes
PallaviKR Absent Member.
Absent Member.

RE: Element Identification when id are not unique

the element have Text value as unique property but using this might cause issue when localized right?

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Element Identification when id are not unique

If the text value is the only unique property for the element which is then different when localized, it would better to implement a unique ID such as an automation id or property which is consistent across any local.

The only recommended solutions I can suggest would be as previously advised

1. Use Image Recognition to interact with the device

2. Construct a unique xpath locator for the element using a parent element

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Element Identification when id are not unique

Additionally, you could try and implement a custom solution which determines the local of the application based on the text value, and if matches a certain value, determine which script to use.

0 Likes
PallaviKR Absent Member.
Absent Member.

RE: Element Identification when id are not unique

Thanks for the response ColinM. If we add custom function to identify the locale, can those scripst be executed from SilkMobile?

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Element Identification when id are not unique

In the Silk Mobile client, you can only open and run tests which use the .xml format of the Silk Mobile scripts. You will need to execute the scripts in the environment which you exported / run your scripts in (e.g. Java, C# etc).

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.