MaskedMessageBox .TextValue property in Visual Studio

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
pcrocker
Posts: 3
Joined: Tue Apr 18, 2017 1:49 pm

MaskedMessageBox .TextValue property in Visual Studio

Post by pcrocker » Tue Apr 18, 2017 2:00 pm

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?

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

Re: MaskedMessageBox .TextValue property in Visual Studio

Post by odklizec » Wed Apr 19, 2017 11:31 am

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.
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

User avatar
Stub
Posts: 173
Joined: Fri Jul 15, 2016 1:35 pm

Re: MaskedMessageBox .TextValue property in Visual Studio

Post by Stub » Wed Apr 19, 2017 12:50 pm

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.

pcrocker
Posts: 3
Joined: Tue Apr 18, 2017 1:49 pm

Re: MaskedMessageBox .TextValue property in Visual Studio

Post by pcrocker » Wed Apr 19, 2017 1:50 pm

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).

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

Re: MaskedMessageBox .TextValue property in Visual Studio

Post by odklizec » Wed Apr 19, 2017 1:56 pm

Hi,

As for the snapshot creation, please follow the link in my signature ;)
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

pcrocker
Posts: 3
Joined: Tue Apr 18, 2017 1:49 pm

Re: MaskedMessageBox .TextValue property in Visual Studio

Post by pcrocker » Wed Apr 19, 2017 2:18 pm

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.