Highlighted
Absent Member.
Absent Member.
590 views

How to click on a link in a specific row of dynamically loaded table.

Hi All
I have a table similar to below in a WPF application.
 
 
 
Table is dynamically loaded based on latest data.
I need to click on 'Default' ( Link) for specific row.
 
e.g. I need to click on 'Default' link for Trump1 , Trump2 row.
 
How should I do it? All locators of default links are same and I cannot differentiate between them.
Is there any I can append First Name locator to Default to figure out which locator to click?
 
Tokci
0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Hi Tokci,

I would recommend reviewing the following links, which discuss creating stable locators:

community.microfocus.com/.../11067

community.microfocus.com/.../creating-stable-locators-with-silktest

For example, a potential stable locator for your example table could be:

//TABLE//TD[@textContents='Trump1']/..//A[@textContents='Default']

I hope this helps.

Regards
Robert
0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Hi Tokci,

with Silk Test 19.0 or later, you can also use the following-sibling to click on such table cells.

 

The locator would look like: //TABLE//TD[@textContents='Trump1']/following-sibling::A[@textContents='Default']

 

For additional info, see Locator Syntax.

Best Regards,

Basilios Will
Technical Author


Micro Focus

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.