Page 1 of 1
OR condition
Posted: Tue Dec 04, 2012 3:46 pm
by michael_esi
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 ?
Re: OR condition
Posted: Tue Dec 04, 2012 4:05 pm
by Ciege
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']
Re: OR condition
Posted: Wed Dec 05, 2012 6:27 am
by michael_esi
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 ?
Re: OR condition
Posted: Wed Dec 05, 2012 1:10 pm
by michael_esi
Hi,
Is there anyway by which I can do this ?
Re: OR condition
Posted: Wed Dec 05, 2012 3:05 pm
by Support Team
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)
Re: OR condition
Posted: Thu Dec 06, 2012 5:42 am
by michael_esi
Thanks Markus ..that helped
...
Re: OR condition
Posted: Thu Dec 06, 2012 9:15 am
by Support Team
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