Community in read only mode June 18 & 19
This community will be set in READ ONLY mode for a while on Tuesday June 18 into Wednesday June 19 while we import content and users from our Micro Focus Forums community site. MORE INFORMATION
David Taggart Respected Contributor.
Respected Contributor.
122 views

Complex XPATH matching

Jump to solution

Is it possible to validate an XPATH in Silk Performer that matches sibling1 AND sibling2? Or perhaps a parent and two children?

I'd like to construct a simple way to validate data in an HTML table where TD[1] = 'something' AND TD[2] = 'something_else'. For example, https://www.w3schools.com/html/html_tables.asp , I would like to confirm that a TR contains both 'Alfreds Futterkiste' AND 'Maria Anders'.

EDIT: According to the XPATH Locator Syntax documentation at https://documentation.microfocus.com/help/index.jsp?topic=%2Fcom.borland.silktest.workbench.doc%2FSILKTEST-B7043980-SUPPORTEDXPATHSUBSET-REF.html&cp=9_3_1_8_1 , the following string SHOULD match two cells in the above-listed example, yet doesn't:

//td[@textContents='Alfreds Futterkiste']/following-sibling::td[1]

Labels (3)
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: Complex XPATH matching

Jump to solution

Hi @David Taggart 

An XPath similar to the following should also work for validating that a table row contains 2 cells with the specified values:

//TABLE//TR//TD[@textContents='Alfreds Futterkiste']/..//TD[@textContents='Maria Anders']

Let me know if that helps.

Robert

0 Likes
3 Replies
David Taggart Respected Contributor.
Respected Contributor.

Re: Complex XPATH matching

Jump to solution

After further research, it appears I was looking at Silk Test documentation and not Silk Performer documentation. There is a difference, and it appears Silk Performer does NOT support XPATH Axes: http://documentation.microfocus.com/help/index.jsp?topic=%2Fcom.microfocus.silkperformer.doc%2FSILKPERF-C92EEE39-BDWLT-DOMELEMENTS-CON.html

Is there any plan to enhance XPATH support in future editions of Performer?

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Complex XPATH matching

Jump to solution

Hi @David Taggart 

An XPath similar to the following should also work for validating that a table row contains 2 cells with the specified values:

//TABLE//TR//TD[@textContents='Alfreds Futterkiste']/..//TD[@textContents='Maria Anders']

Let me know if that helps.

Robert

0 Likes
David Taggart Respected Contributor.
Respected Contributor.

Re: Complex XPATH matching

Jump to solution

Thanks for the tip Robert. Doesn't work for me in Silk Performer 17.5 HF5. I may play with it later.

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.