Hi there
I'm a beginner on Ranorex.
Not sure if this is possible. Here's the situation for our test kit. We have two printers. Plug one printer in and the name of the printer is shown at the bottom of the screen. I want to validate this UI element so that the test will pass if any one of the 2 printer names are shown at the bottom. Is it possible to do this under one test action by validating either one of two attributes against a UI element? I just want the test to look at the text.
If I create two separate test actions to validate the UI element for each name, then at least one of these tests is always going to fail because we can only plug in one printer. Eg test for printer A, test for printer B. One of these will fail so is it possible to check the text for either one of these values so that the test will pass if at least one of the text is showing.
Thanks
How to validate either one of two possible attributes
Re: How to validate either one of two possible attributes
Hi,
Could you please upload a Ranorex snapshot (not screenshot!) of the element in question? Also, please post the xpath you are using to identify the control.
In my opinion, the easiest way to achieve what you want is to create a xpath containing both printer names separated by "OR" operator. E.g. something like this:
Then simply use Validate Exists action to validate the existence of the xpath.
Could you please upload a Ranorex snapshot (not screenshot!) of the element in question? Also, please post the xpath you are using to identify the control.
In my opinion, the easiest way to achieve what you want is to create a xpath containing both printer names separated by "OR" operator. E.g. something like this:
Code: Select all
//text[@innertext~'How' or @innertext~'validate']
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: How to validate either one of two possible attributes
Hi again
Thanks for the prompt response.
We've tried using the OR statement although we'r not entirely sure if this was done correctly.
I believe this is the xpath for the element
/form[@controlname='AlternateTill']/?/?/text[@accessiblename='Print After: BA-T500']
Please find attached the ranorex snapshot. I have also attached screenshots of the two printer types as previously mentioned.
Hope this is the correct information. If you need anything else please let me know.
Thanks
Peter
Thanks for the prompt response.
We've tried using the OR statement although we'r not entirely sure if this was done correctly.
I believe this is the xpath for the element
/form[@controlname='AlternateTill']/?/?/text[@accessiblename='Print After: BA-T500']
Please find attached the ranorex snapshot. I have also attached screenshots of the two printer types as previously mentioned.
Hope this is the correct information. If you need anything else please let me know.
Thanks
Peter
- Attachments
-
- printer type 2.PNG (9.74 KiB) Viewed 1135 times
-
- printer type 1.PNG (10.26 KiB) Viewed 1135 times
-
- Element Snapshot.rxsnp
- (311.66 KiB) Downloaded 34 times
Re: How to validate either one of two possible attributes
Hi,
Thanks for the snapshot and xpath. You can use for example xpath like this:
Thanks for the snapshot and xpath. You can use for example xpath like this:
Then simply add the Validate Exists action, using the repoelement with above xpath. If there will be no or different printer used, the validation should fail./form[@controlname='AlternateTill']/statusbar/text[@accessiblename='Print After: BA-T500' or @accessiblename='Print After: com2']
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: How to validate either one of two possible attributes
Working now. That's great. Thanks for your help. I'll add this to my knowledge database 
