Get value and RegEx
Posted: Wed Nov 28, 2018 2:05 pm
Hi!
I've got a simple, quick question. Here it is.
I have an element in front of me that looks exactly like that:
and another one that looks exactly like that:
What I need to do with them is to get value from the element'slabel from the first screenshot (forget the checkboxes, I don't need those) and check if the first bullet point of the element shown on the second screenshot contains it. The way I want to do this is as follows:
1. Use Get Value action using RegEx (in order to get everything exept spaces, tabs, new lines etc.) and assign it to a variable:
2. Use InnerText Validation action to check.
The problem is as follows:
Get Value action ends gathering the text after first match. Which results in creating a string like '1' or 'Drilling' (one letter or one word). Every time I try different RegEx it either ends up as in case described above, or it ends with something like '↵········1/4·-·5/8·in↵········↵········↵····'. And believe me - I tried every possible angle. Including '/s' and '/S' to avoid whitespaces or even '[^ ]'. Nothing works. There are only two possible reasons for that:
1. I'm doing something wrong or I there is something inside Ranorex I don't know about.
2. Ranorex didn't anticipate a basic testing function which is value comparison.
I know about the RegEx 'toolkit' which is not, infact, a toolkit but a simple RegEx validator. I also know that I could write a simple sanitizer and put it there as a code. But I wanted to use Ranorex itself, as it's advertised. As an all-around comprehensive testing tool.
I will be very obliged for any help, suggestion or - hopefully - an answer.
I've got a simple, quick question. Here it is.
I have an element in front of me that looks exactly like that:
and another one that looks exactly like that:
What I need to do with them is to get value from the element'slabel from the first screenshot (forget the checkboxes, I don't need those) and check if the first bullet point of the element shown on the second screenshot contains it. The way I want to do this is as follows:
1. Use Get Value action using RegEx (in order to get everything exept spaces, tabs, new lines etc.) and assign it to a variable:
2. Use InnerText Validation action to check.
The problem is as follows:
Get Value action ends gathering the text after first match. Which results in creating a string like '1' or 'Drilling' (one letter or one word). Every time I try different RegEx it either ends up as in case described above, or it ends with something like '↵········1/4·-·5/8·in↵········↵········↵····'. And believe me - I tried every possible angle. Including '/s' and '/S' to avoid whitespaces or even '[^ ]'. Nothing works. There are only two possible reasons for that:
1. I'm doing something wrong or I there is something inside Ranorex I don't know about.
2. Ranorex didn't anticipate a basic testing function which is value comparison.
I know about the RegEx 'toolkit' which is not, infact, a toolkit but a simple RegEx validator. I also know that I could write a simple sanitizer and put it there as a code. But I wanted to use Ranorex itself, as it's advertised. As an all-around comprehensive testing tool.
I will be very obliged for any help, suggestion or - hopefully - an answer.