【问题标题】:Windows 10 - IE 11 Windows Secruity Popup - AutoIT returns no control informationWindows 10 - IE 11 Windows 安全弹出窗口 - AutoIT 不返回控制信息
【发布时间】:2016-10-07 08:54:49
【问题描述】:

我正在更新一个使用 Selenium webdriver 进行浏览器测试的 C# 测试框架。启动每个测试用例后,我需要绕过 Windows 安全弹出窗口(IE11:v11.187.14393.0)才能进入我正在测试的开发站点。我以前使用 AutoIt 和以下代码进行过这项工作。

      AutoItX3 autoIt = new AutoItX3();
      string windowTitle = "Windows Security";

      // Wait 30 seconds max...
      autoIt.WinWait(windowTitle, string.Empty, 30);

      // Need to wait for input fields to load...
      Thread.Sleep(2000);

      autoIt.WinActivate(windowTitle);
      autoIt.ControlSetText(windowTitle, string.Empty, "[CLASS:Edit; INSTANCE:1]", username);
      autoIt.ControlSetText(windowTitle, string.Empty, "[CLASS:Edit; INSTANCE:2]", password);
      autoIt.ControlClick(windowTitle, "OK", "[CLASS:Button; INSTANCE:2]");
      autoIt.WinWaitClose(windowTitle, string.Empty, 10);

我已经将我的操作系统更新到 Windows 10,并且弹出框已经改变(见下文)

See new security popup example

See old secruity popup example

AutoIt 检查器不再为安全弹出窗口中的任何对象返回任何控制信息,因此我无法与它们交互。 (见下文他的检查员为用户名输入框返回的内容)

窗口

控制 实例:
类名NN:
名称:
高级(类):
ID: 正文:
当前位置:
尺寸:
ControlClick 坐标:
风格:
ExStyle:
句柄:

鼠标

状态栏

工具栏

可见文本

隐藏文字

我尝试将 AutoIt 指向活动窗口并直接发送密钥,但这也不起作用。 (见下面的代码)。

        string windowTitle = "Windows Security";

        // Wait 30 seconds max...
        autoIt.WinWait(windowTitle, string.Empty, 30);

        // Need to wait for input fields to load...
        Thread.Sleep(2000);

        autoIt.WinActivate(windowTitle);
        autoIt.Send(username);
        autoIt.Send(Keys.Tab.ToString());
        autoIt.Send(password);
        autoIt.Send(Keys.Enter.ToString());
        autoIt.WinWaitClose(windowTitle, string.Empty, 10);

有没有人知道我该如何克服这个问题?

谢谢

【问题讨论】:

    标签: c# internet-explorer-11 ui-automation autoit-c#-wrapper


    【解决方案1】:

    新对话是 XAML。 AutoIt 仅适用于 Win32 应用程序。如果您想与该对话进行交互,我建议您使用UI Automation。如果您仍想使用 AutoIt,您可以尝试使用它直接向控件发送 Windows 消息,但您需要使用其他工具来获取控件的 ID。该论坛建议使用AutoIt script 发送Windows 消息,我建议使用Windows SDK 附带的Inspect.exe。 Inspect.exe 是取代该论坛帖子中提到的 UiSpy 的工具。

    在我的公司,当我们从 VB6 应用程序转到 WPF 应用程序时,我们不得不从 AutoIt 切换到 UI 自动化。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-08
      • 2019-05-25
      • 1970-01-01
      • 2013-08-02
      • 1970-01-01
      相关资源
      最近更新 更多