Using RanoreXPath to identify two columns in one row?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Using RanoreXPath to identify two columns in one row?

Post by kmck » Mon Jul 15, 2013 1:24 pm

I believe this is possible with standard XPath strings using contains() and combining XPath strings, but I'm having trouble implementing this with Ranorex.

For instance, searching for a row index 1, cell index 1 = hello and cell index 2 = world.

Rather than just searching for 'hello' in the one cell, I want to search for both 'hello' and 'world' in each respective cell.

Can I achieve this with RanoreXPath?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Using RanoreXPath to identify two columns in one row?

Post by krstcs » Mon Jul 15, 2013 1:49 pm

For a HTML DOM object it could be:

Code: Select all

//table/tbody/tr/td[@innertext='hello']/following-sibling::td[@innertext='world']
http://www.ranorex.com/support/user-gui ... ditor.html

Checkout that page for a lot of other relational operations.
Shortcuts usually aren't...

kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Re: Using RanoreXPath to identify two columns in one row?

Post by kmck » Mon Jul 15, 2013 5:29 pm

Thank you, krstcs! That was exactly what I needed.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Using RanoreXPath to identify two columns in one row?

Post by krstcs » Mon Jul 15, 2013 7:47 pm

You are very welcome.

I use parent:: all the time. I will use a title or other sub-heading to identify the whole group (a row in a table, for example) and then back out of it to "home" all of the row's objects.

This points to the row containing a td/span with the innertext of "My Widget":

Code: Select all

//table/tbody/tr/td/span[@innertext="My Widget"]/parent::td/parent::tr
You can get really fancy with it if needed.
Shortcuts usually aren't...