【问题标题】:Write text to PasswordBox using Teststack.White使用 Teststack.White 将文本写入 PasswordBox
【发布时间】:2019-01-26 09:36:48
【问题描述】:

我正在尝试使用 TestStack.White 在我的 WPF 应用程序中将密码写入 PasswordBox

我可以使用

找到 PasswordBox

private TextBox Password => Window.Get<TextBox>(1);

但是使用Password.Text = "TestPassword" 不起作用

我也尝试使用

访问键盘
Password.ClickAtCenter();
Thread.Sleep(1000);
keyboard.Enter(user.Password);

但没有任何运气。

如何使用 White 在 PasswordBox 中输入文本?

【问题讨论】:

  • 应该有Password属性:Password.Password = "TestPassword";
  • 没有,因为我使用的是 White 的 TextBox 类

标签: c# wpf ui-automation white-framework


【解决方案1】:

使用teststack.white.textbox的Enter()方法

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-19
    • 1970-01-01
    相关资源
    最近更新 更多