Attribute does not match the specified value although the actual value is the same as expected

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Alexey
Posts: 3
Joined: Wed Jun 03, 2020 9:36 am

Attribute does not match the specified value although the actual value is the same as expected

Post by Alexey » Wed Jun 03, 2020 9:55 am

I created a simple data-driven (from csv) test for the Windows Calculator. Very simple - number 1, Operation, number 2, check result. Here is the example of data in csv-file:
Number1,Action,Number2,Result
2,+,34,36
5,-,2,3
Now, the check result step fails because actual value does not match the expected value. But both values are identical:
Attribute 'Text' of element for item 'RechneZahlenRepository.Rechner.NormalOutput' does not match the specified value (actual='‭36‬', expected='36').
When I compare the code of this data driven test with the code of a recorded test (which works fine) I see no difference:

DDT:

Code: Select all

Validate.AttributeEqual(repo.Rechner.NormalOutputInfo, "Text", Result);
Delay.Milliseconds(100);
Recorded:

Code: Select all

Validate.AttributeEqual(repo.Rechner.NormalOutputInfo, "Text", "‭7.463‬");
Delay.Milliseconds(100);
What is the prblem and how do I solve it?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6280
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Attribute does not match the specified value although the actual value is the same as expected

Post by odklizec » Wed Jun 03, 2020 11:57 am

Hi,

Could you please post entire (zipped) sample solution? It would be much easier for us to debug the problem and without the need to recreate the whole solution. Thanks. BTW, are you using most recent Ranorex 9.3.2?
Pavel Kudrys
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

Alexey
Posts: 3
Joined: Wed Jun 03, 2020 9:36 am

Re: Attribute does not match the specified value although the actual value is the same as expected

Post by Alexey » Wed Jun 03, 2020 12:23 pm

Yes, I'm using 9.3.2.

zip (with a couple of logs/reports) attached.
Attachments
RechneZahlen.zip
(1.55 MiB) Downloaded 7 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6280
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Attribute does not match the specified value although the actual value is the same as expected

Post by odklizec » Wed Jun 03, 2020 1:01 pm

Hi,

Well, the problem is, that text in Calculator output label contains some invisible characters...
2020-06-03_13-49-44.png
2020-06-03_13-49-44.png (53.64 KiB) Viewed 143 times
So the solution is to replace AttributeEqual with AttributeContains. However, this might not be the best solution, because in case the result is something like "336", Validate AttributeContains "36" will still pass ;) Therefore, you should first get the value from label, strip it from all non-numeric characters and only then validate with expected result. Basically, you can do something like this:
2020-06-03_14-18-25.png
2020-06-03_14-18-25.png (16.09 KiB) Viewed 140 times
Pavel Kudrys
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

Alexey
Posts: 3
Joined: Wed Jun 03, 2020 9:36 am

Re: Attribute does not match the specified value although the actual value is the same as expected

Post by Alexey » Thu Jun 04, 2020 6:35 am

I got it. Thank you very much!