Attribute does not match (actual='(null)', expected='')?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
mrt
Posts: 88
Joined: Mon Mar 16, 2020 11:31 am

Attribute does not match (actual='(null)', expected='')?

Post by mrt » Wed Dec 09, 2020 12:51 pm

Hey folks,

I got a web formular with several inputs filled by data source, on saving these inputs become read-only.
When I run my validation of the entered values all goes well, except when I leave an input empty, then the validation fails with:
Attribute 'TagValue' of element for item 'myitem' does not match the specified value (actual='(null)', expected='').
I tried other attributes, but only value and tagvalue are set when putting in some value, so I am out of ideas.

How can I tell Ranorex to apply a (null)= empty to the validation?

In this thread (quite old):
https://ranorex.com/forum/failure-on-ex ... t1741.html
the support team states:
With the upcoming release Ranorex 2.3.5 there will be a functionality in the RxPath that allows you a comparison with null values.
This was released some time ago, but maybe it will be helpful, how can I make use of this?

I have hundreds of validation actions, do I really have to implement my own validation function which compares (null) with empty string?
If possible, I would want to avoid this.

thank you, BR
Last edited by mrt on Wed Dec 09, 2020 2:35 pm, edited 1 time in total.

User avatar
Mike K
Certified Professional
Certified Professional
Posts: 28
Joined: Wed Jun 28, 2017 5:58 pm

Re: Attribute does not match (actual='(null)', expected='')?

Post by Mike K » Wed Dec 09, 2020 2:22 pm

Hello,

Try setting the RxPath to identify multiple conditions by editing the expected values like this:

/dom[@domain='www.ranorex.com']//input[@tagvalue='John' or tagvalue='(null)' or tagvalue='']

If the object matches any of these 'OR' conditions, it will pass validation.

mrt
Posts: 88
Joined: Mon Mar 16, 2020 11:31 am

Re: Attribute does not match (actual='(null)', expected='')?

Post by mrt » Wed Dec 09, 2020 2:33 pm

Hi,

thanks for your suggestion, but that would make the whole validation obsolete.

If I accept a validation result either if it is the real value, or null, or empty - then I do not need to validate, because it will success almost always.

Code: Select all

Input: John  -> Validation: true
Input: empty -> Validation: true
Input: John, but saving failed, so field is empty -> Validation: true
;)

dkmpbrt
Posts: 31
Joined: Thu Jan 25, 2018 9:00 am
Location: Antwerp
Contact:

Re: Attribute does not match (actual='(null)', expected='')?

Post by dkmpbrt » Mon Dec 14, 2020 8:56 am

Hey,

I think you can just fill in "(null)" under "Match value" to check if the field is null.

kr,
Bart

mrt
Posts: 88
Joined: Mon Mar 16, 2020 11:31 am

Re: Attribute does not match (actual='(null)', expected='')?

Post by mrt » Mon Dec 14, 2020 2:46 pm

Hmm, I think I did not make clear what's the purpose of this whole exercise, so let me precise:

Workflow:
  • Open a webpage
  • Fill a value from data source into a input text box
  • Hit Save button
Validation:
  • Navigate to another section in the webpage
  • Check if the value in read-only box is displayed like entered previously
It is possible to enter a value into the text box, or to leave it empty.

When entering some value, I can validate against the bound data source variable without issue.
BUT, when the data source variable is empty '' the validation fails because it reads '(null)' instead of the entered ''.

So @dkmpbrt if I understand you correctly, just adding a Validation if value equals '(null)' would only work if nothing is entered and would obviously fail if a value is entered.

Did I make this clearer, or is it more confusing than before? :mrgreen:

dkmpbrt
Posts: 31
Joined: Thu Jan 25, 2018 9:00 am
Location: Antwerp
Contact:

Re: Attribute does not match (actual='(null)', expected='')?

Post by dkmpbrt » Thu Dec 17, 2020 1:54 pm

Hey mrt,

Indeed, if you validate against (null) it will only pass if it's empty and will fail if something is filled in.

Could you please tell me what type of input you're using?

If it's just a text-input, maybe try validating on the "Value" instead of "TagValue"?

Kr,
Bart