Hello,
Is there anybody let me know how to store the element id from XPath and used in another XPath?
My Scenario is:
I'm creating a component and the component generating the unique component id, other value like class are same for all other components but div id is different. After create the component I want to click on that created component. The issue is, component name could be same.
Please let me know how can I click on same created component?
Can I store the component ID in some variable from XPath and use that variable in another XPath while I want to click over that?
Thanks
How to store the element ID in variable and used in XPath?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to store the element ID in variable and used in XPath?
Hello,
In order to store the ID in a variable you could use the code below. Please make sure that you use the correct Ranorex.Adapter. You would need to create a repository variable (elementID) at first.
Regards,
Markus (T)
In order to store the ID in a variable you could use the code below. Please make sure that you use the correct Ranorex.Adapter. You would need to create a repository variable (elementID) at first.
Ranorex.InputTag element; Host.Local.TryFindSingle("/dom[@domain='www.ranorex.com' and @caption='Ranorex Test Page']//input[@id='testname']", out element); repo.elementID = element.Id;After that you could use the method 'TryFindSingle' to get the element and perform a Click() action on it.
Regards,
Markus (T)