gpt4 book ai didi

WPF 编码的 UI 测试 : Encrypting password read from datasource

转载 作者:行者123 更新时间:2023-12-02 05:00:07 25 4
gpt4 key购买 nike

我使用编码的 UI 测试生成器创建了一个录制的操作,将用户凭据输入到登录窗口中。该初始记录将加密密码硬编码到公共(public)字段中测试方法使用的 Params 对象,如下所示:

[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]
public class StartOccUIParams
{

#region Fields
/// <summary>
/// Type 'username' in 'usernameBox' text box
/// </summary>
public string UIUsernameBoxEditText = "username";

/// <summary>
/// Type '{Tab}' in 'usernameBox' text box
/// </summary>
public string UIUsernameBoxEditSendKeys = "{Tab}";

/// <summary>
/// Type '********' in 'passwordBox' text box
/// </summary>
public string UIPasswordBoxEditSendKeys = "9927b9lJLxdZrqR1G+zHC2MA==";
#endregion
}

这很有效,但我需要从 CSV 数据源检索用户名和密码来测试失败条件。问题是,如何将从 CSV 检索到的密码转换为可与密码框一起使用的加密形式?我查看了 SecureString,但它没有公开 API 来获取加密字符串,我怀疑该字符串的形式是否正确。

   var loginParams = UIMap.StartOccUiParams;
loginParams.UIUsernameBoxEditText = TestContext.DataRow["User"].ToString();
var password= TestContext.DataRow["Password"].ToString();

// how do I encrypt password to use below ?
loginParams.UIPasswordBoxEditSendKeys = "encrypted password";

最佳答案

使用Playback.EncryptText

Encrypts a given text for passing to playback as password property.

关于WPF 编码的 UI 测试 : Encrypting password read from datasource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10436258/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com