Searching for a particular value in XPath

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
vivek.guvva
Posts: 31
Joined: Mon Feb 22, 2016 7:21 pm

Searching for a particular value in XPath

Post by vivek.guvva » Thu Feb 25, 2016 5:18 pm

Hi,

There is a text filed in my application. If i enter something in text field, related options will show as a dropdown list in the text box. When those drop down values are displayed, I need to search for for the option using InnetText value, compare that inner text to a variable and then select the option if innertext matches with the variable. Please let me know the way to do this.

Thanks
Vivek
You do not have the required permissions to view the files attached to this post.
Last edited by vivek.guvva on Thu Feb 25, 2016 8:20 pm, edited 1 time in total.

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

Re: Searching for a particular value in XPath

Post by krstcs » Thu Feb 25, 2016 7:20 pm

Please create a Ranorex Snapshot (not a screenshot) and post it here.

Otherwise, it will be almost impossible to help as we don't know what the structure of your application's interface is without the snapshot.

Please also include the current RanoreXPaths that you are using for all mentioned elements as well as what variables you are using and the values of the related elements in the snapshot.
Shortcuts usually aren't...

vivek.guvva
Posts: 31
Joined: Mon Feb 22, 2016 7:21 pm

Re: Searching for a particular value in XPath

Post by vivek.guvva » Thu Feb 25, 2016 8:24 pm

krstcs wrote:Please create a Ranorex Snapshot (not a screenshot) and post it here.

Otherwise, it will be almost impossible to help as we don't know what the structure of your application's interface is without the snapshot.

Please also include the current RanoreXPaths that you are using for all mentioned elements as well as what variables you are using and the values of the related elements in the snapshot.

I have attached the sample snapshot from google. The scenario is, I am searching for "Michael Jackson". When I type "Michael" in search text box field, we got the options as dropdown and second option is "Michael Jackson". What I need to do is, I need to compare each value of the dropdown with the actual search value (Michael Jackson) and then click on that option.

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

Re: Searching for a particular value in XPath

Post by krstcs » Thu Feb 25, 2016 9:32 pm

I would do this:

1. Open Ranorex Spy (or Studio with the repo open) while you have the application open.
2. Start typing in the field so that the auto-complete box opens.
3. Mouse-over (**don't click!**) the desired item.
4. Press Ctrl-LWin with the mouse over the item. This will capture the item's element in Spy (or add it to the repo if it isn't already there and you have Studio open) so you can work with it.

You will need to variablize the XPath so that the value you need is in the XPath variable. Ranorex recalculates the XPath at runtime if there is a variable.
Shortcuts usually aren't...