Win7 SP1 64 bits
Ranorex 5.2.0
*********************************
Hello,
I cannot use a variable in a regex for validation with AttributeRegEx.
The result:
I have a workaround (topic 4), but it is harder for my real test
Any idea?
Regards
AttributeRegEx with variable
AttributeRegEx with variable
You do not have the required permissions to view the files attached to this post.
SW
Re: AttributeRegEx with variable
Hi,
I may be wrong, but it seems it's not possible to combine the variable and regex in Recording validation, using the AttributeRegEx option? There are two workarounds, both require the use of User Code action.
First, convert your AttributeRegEx action to user code, right click the converted step and select View Code. this should move you to just converted code. Then simply change the new Regex("(?i:'+$Var2+')") to new Regex("(?i:"+Var2+")"). This should do the trick
Another option is to add the regex directly to variable, via a User Code step placed before the validation step. Then just validate the variable.
Example of user code:
Hope this helps?
I may be wrong, but it seems it's not possible to combine the variable and regex in Recording validation, using the AttributeRegEx option? There are two workarounds, both require the use of User Code action.
First, convert your AttributeRegEx action to user code, right click the converted step and select View Code. this should move you to just converted code. Then simply change the new Regex("(?i:'+$Var2+')") to new Regex("(?i:"+Var2+")"). This should do the trick
Another option is to add the regex directly to variable, via a User Code step placed before the validation step. Then just validate the variable.
Example of user code:
Code: Select all
public void SetVar()
{
Var2 = "(?i:"+Var2+")";
}
You do not have the required permissions to view the files attached to this post.
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: AttributeRegEx with variable
Hello odklizec,
Thanks for your suggestions. As I write in my first post I also have another workaround with the Regex in the repository.
It is strange (not orthogonal) to have the possibility to use a variable and Regex in the repository and not with Validate (AttributeRegEx)
Thanks for your suggestions. As I write in my first post I also have another workaround with the Regex in the repository.
It is strange (not orthogonal) to have the possibility to use a variable and Regex in the repository and not with Validate (AttributeRegEx)
SW