GetAttributeValue does not work with generic arguments
Posted: Wed Jul 12, 2017 10:02 pm
I've had my own code in my test suite for a while now. After I upgrade to Ranorex 7.1, that code stopped working correctly. Specifically, if I have some InputTag inputTag, inputTag.GetAttributeValue<bool>("Checked") always returns False. Some example codes and outputs follow.
(for confidentiality reasons, I replaced the actual name with 'correctName' in the below text)
For this, the output was actually what we'd expect:
Code: Select all
var inputTag = adapter as InputTag;
Report.Info("Checked " + inputTag?.Checked + " " + inputTag?.GetAttributeValue<bool>("Checked"));
Report.Info("Maxlength " + inputTag?.Maxlength + " " + inputTag?.GetAttributeValue<int>("Maxlength"));
Report.Info("Name " + inputTag?.Name + " " + inputTag?.GetAttributeValue<string>("Name"));
Note that the Name is correct for both. I noticed that and decided to see what happened if I converted it all to a string.Checked True False
Maxlength 2147483647 0
Name correctName correctName
Code: Select all
var inputTag = adapter as InputTag;
Report.Info("Checked " + inputTag?.Checked + " " + inputTag?.GetAttributeValue<string>("Checked"));
Report.Info("Maxlength " + inputTag?.Maxlength + " " + inputTag?.GetAttributeValue<string>("Maxlength"));
Report.Info("Name " + inputTag?.Name + " " + inputTag?.GetAttributeValue<string>("Name"));
As far as I can tell, this is a regression from 7.0. Also worth noting is that I also upgraded my suite to use C# 6 and .net 4.6. I have not tested with previous C# or .net versions.Checked True True
Maxlength 2147483647 2147483647
Name correctName correctName