Hi,
Can I have conditions for the adapters themselves and not attributes?
I know attributes can have conditions with in them. Ex: text[@name='name' and @visible='true']
Now, can i use condition for adapters?
Example: \form[@name='form1'] or element[@name='Popuppanel']\text[@text='sometext']\
We have situation where a group of objects appear with in a form or within a popup, all these objects are same. We dont want to add objects for both of these since they are duplicates. Now, we can eliminate the form and popup by just using '//' but this slows down the script.
So, is there a way to use conditions like above?
XPath: Conditions for the adapters themselves
- testautomator
- Posts: 67
- Joined: Fri Oct 25, 2013 6:37 am
- Location: Bangalore, India
Re: XPath: Conditions for the adapters themselves
Unfortunately, no, you can't use conditionals on adapters.
However, all adapters are based off of the element type, so you can just use "element" like below.
However, all adapters are based off of the element type, so you can just use "element" like below.
Code: Select all
/element[@name='form1' or @name='Popuppanel']/text[@text='sometext']
Shortcuts usually aren't...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: XPath: Conditions for the adapters themselves
Just a small correction: "element" in a RanoreXPath really only gets you "element" elements. If you want to get all elements regardless of their role, use the "*" operator, e.g.:
See the corresponding topic in the user guide for more information.
Regards,
Alex
Ranorex Team
Code: Select all
/*[@name='form1' or @name='Popuppanel']/*[@text='sometext']
Regards,
Alex
Ranorex Team
- testautomator
- Posts: 67
- Joined: Fri Oct 25, 2013 6:37 am
- Location: Bangalore, India
Re: XPath: Conditions for the adapters themselves
Cool!!
Thanks krstcs and Alex. I have tried it and its working. Now, I have to check out the performance with or without the adapter conditions.
Thanks krstcs and Alex. I have tried it and its working. Now, I have to check out the performance with or without the adapter conditions.
- testautomator
- Posts: 67
- Joined: Fri Oct 25, 2013 6:37 am
- Location: Bangalore, India
Re: XPath: Conditions for the adapters themselves
I have tried and it looks like not much difference!! Maybe, we will do more tests. Run them in bulk and see if its faster or its same.
Re: XPath: Conditions for the adapters themselves
Excellent, I learn something new every day. 
Thanks Alex!

Thanks Alex!
Shortcuts usually aren't...