Page 1 of 1

MaskedMessageBox .TextValue property in Visual Studio

Posted: Tue Apr 18, 2017 2:00 pm
by pcrocker
Our WPF application has a masked messagebox. In Ranorex Spy when we access it as
var password = repo.MainApp.Login.Password;
string strPassword = password.TextValue;
the .TextValue property is '*************' which is what we want to verify.

We wrap all our tests as coded UI tests for execution with our builds. When this particular test is wrapped, the test fails because the .TextValue property is being returned as null. Debugging in VS reveals the Ranorex.Text object is still found, but the property is always null. I tried the technique described at ranorex.com/forum/cannot-get-text-value-from-textboxmaskbox-t1408.html but this did not change the behavior. Anyone have ideas or have seen something similar?

Re: MaskedMessageBox .TextValue property in Visual Studio

Posted: Wed Apr 19, 2017 11:31 am
by odklizec
Hi,

Please upload a Ranorex snapshot of the problematic element, in which we can evaluate the element and its attributes. There is not much anyone here can do without at LEAST Ranorex snapshot.

Re: MaskedMessageBox .TextValue property in Visual Studio

Posted: Wed Apr 19, 2017 12:50 pm
by Stub
I too came across that null TextValue for password fields with Ranorex v6.2.1, though my AUT is a legacy Windows application. I took to detecting the null TextValue and using a different technique to adjust the value to my requirements. I ended up having to right-click, Select All, then press delete so I could put a value into the field.

I didn't realise there may be other techniques to handling masked password fields.

Re: MaskedMessageBox .TextValue property in Visual Studio

Posted: Wed Apr 19, 2017 1:50 pm
by pcrocker
I was able to resolve my issue. I have been using the setting UIAPreferred (Settings -> Plugins -> WPF -> WPF Legacy/UIA Interaction), however, for some reason the behavior in Visual Studio was the same for this element and others as when the setting was set to the value WPFImprovedOnly.

I added the below code to my codedUI wrapper in Visual Studio and everything works as it does in Ranorex which was my original goal

Code: Select all

Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.UiaPreferred;            Configuration.Current.SaveToUserSettings();
As for your request for the element can you explain the typical way for getting a Ranorex snapshot (sorry newbie here)? I would be happy to provide if I knew exactly what you needed (provided I don't have to upload any proprietary data).

Re: MaskedMessageBox .TextValue property in Visual Studio

Posted: Wed Apr 19, 2017 1:56 pm
by odklizec
Hi,

As for the snapshot creation, please follow the link in my signature ;)

Re: MaskedMessageBox .TextValue property in Visual Studio

Posted: Wed Apr 19, 2017 2:18 pm
by pcrocker
I sent 2 snapshots to Ranorex support as mentioned in your link. The "Text" property in the spy tool seems to be in alignment with the value I get in code. That is, when the setting was set to UIAPreferred I see the '*********' value in the spy tool, but when set to WPFImprovedOnly the Text property was null.

As noted in my earlier reply, I was able to workaround the issue by setting in code UIAPreferred so the issue is not pressing to me, but I'm at least curious about 2 questions:

1) Why was the setting from Ranorex not carried over to Visual Studio when I add a codedUI Project (created in Visual Studio 2017 then added via Ranorex) to the solution? I couldn't find documentation on how to do this in VS 2017 so just took my best shot at what seemed logical

2) Why is the .TextValue property null when in WPFImprovedOnly when it has a value in UIAPreferred. I have seen this behavior in a # of other fields in my legacy WPF app (not all masked) which is why I have been using the UIAPreferred setting.