CodedUI test - can't send plain text password into input field

2.7k views Asked by At

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();
    }
2

There are 2 answers

1
Ryan Cox On

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

0
emamones On

Use the EncryptText Method for this Password types:

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

    pincode.Password = Playback.EncryptText("1234");