0

at some point when I send password into the input field on the form, looks like it gets encrypted. Password length is 8, but CodedUI is entering more characters, it's visible during test execution. Any idea, how to pass just string without any encoding?

P.s.

UIPassEdit.Text = password //Doesn't help as well.

Code sample:

public PasswordFormPage Login(string password)
    {
        Keyboard.SendKeys(UIPassEdit, password, false);
        Mouse.Click(UISignInHlnk);
        return PasswordFormPage.Instance();
    }
xmp
  • 104
  • 1
  • 4
  • Have you tried using UI Automation's [ValuePattern](http://msdn.microsoft.com/en-us/library/system.windows.automation.valuepattern.setvalue%28v=vs.110%29.aspx)? is it available for your password-text-field? – Haphil Jan 08 '15 at 11:07
  • No, it's not available for my controls. – xmp Jan 12 '15 at 10:29
  • 1
    Okay, if you can change the Application's password-field, than you could implement the IValuePatternProvider to this UIComponent in order to update the UIComponents behaviour. One more question: Does the field behave the same, if you enter it on your own keyboard? If it behaves correct, I believe you could use the win32.dll in order to send actual key-commands. – Haphil Jan 12 '15 at 10:56
  • Thanks Hansa. I forgot to mention that the edit controls is a simple web form embedded into desktop app. At his moment issues was solved be reverting all changes to the SendKeys. I've also found that there was a bug in Windows which potentially could be a root cause. – xmp Jan 14 '15 at 13:01

2 Answers2

2

Try using UIPassEdit.Password = password; The .Password field obfuscates the string, allowing you to pass an un-encrypted string to the field correctly.

Ryan Cox
  • 938
  • 1
  • 7
  • 22
1

Use the EncryptText Method for this Password types:

var pincode = editForm.SearchControl<HtmlEdit>(2, new { Name = "pinCode" });

    pincode.Password = Playback.EncryptText("1234");
emamones
  • 77
  • 7