OR condition

Ranorex Studio, Spy, Recorder, and Driver.
michael_esi
Posts: 10
Joined: Mon Nov 05, 2012 10:27 am

OR condition

Post by michael_esi » Tue Dec 04, 2012 3:46 pm

Hi

I need to check in the ui whether there is a button by the name of 'Start' or 'Click To Start'
My test module has a click action on the button.

example..

this is the xpath in my app
.../button[@id='btnstart']/form/contextmenu/menuitem[@name='Start']

I need the test to run successfully if the button is having 'Start' or 'Click to start' as text .
How do i do that using ranorex ? is OR condition possible ?

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: OR condition

Post by Ciege » Tue Dec 04, 2012 4:05 pm

Sure you can use an Or in your RXPath... Something like the following:

.../button[@id='btnstart']/form/contextmenu/menuitem[@name='Start' or @name='Click to start']
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

michael_esi
Posts: 10
Joined: Mon Nov 05, 2012 10:27 am

Re: OR condition

Post by michael_esi » Wed Dec 05, 2012 6:27 am

Hi Ciege,

Thanks for the help. I have another query.

In my recording module, there is an action that validates using attribute equals. Here It checks if the attribute equals for the specified text.

In my case, the validation should be successfull if the text equals "Welcome" or "Welcome User" ..
query1.PNG
How can I use the OR condition here ?
You do not have the required permissions to view the files attached to this post.

michael_esi
Posts: 10
Joined: Mon Nov 05, 2012 10:27 am

Re: OR condition

Post by michael_esi » Wed Dec 05, 2012 1:10 pm

Hi,

Is there anyway by which I can do this ?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: OR condition

Post by Support Team » Wed Dec 05, 2012 3:05 pm

Hello,

You could use the 'AttributeContains' method in order to achieve this as shown below:
Validate_AttributeContains.JPG
Note: This method is looking for any values that contains 'Welcome'.

Regards,
Markus (T)
You do not have the required permissions to view the files attached to this post.

michael_esi
Posts: 10
Joined: Mon Nov 05, 2012 10:27 am

Re: OR condition

Post by michael_esi » Thu Dec 06, 2012 5:42 am

Thanks Markus ..that helped :) ...

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: OR condition

Post by Support Team » Thu Dec 06, 2012 9:15 am

Just a short follow-up on the topic:
If you want tighter control, which text should validate and which should fail, I'd recommend using the "AttributeRegEx" comparison value. You can then specify a regular expression that defines which text is ok.

Regards,
Alex
Ranorex Team