zoukankan      html  css  js  c++  java
  • UIAutomation学习

    1. 在另一线程中执行Find等操作
      代码
      IntPtr handle = frm.Handle;

      Action act = () =>
      {
          UIAutomationMapping mapping = new UIAutomationMapping(handle);

          
      foreach (AutomationElement item in mapping.CheckedListBoxColumnNamesRows)
          {
              item.SetFocus();
              SendKeys.SendWait(" ");  // Send a {SPACE} to check the checkbox. 
          }

          InvokePattern aeOkButtonClick = (InvokePattern)mapping.ButtonOk.GetCurrentPattern(InvokePattern.Pattern);
          aeOkButtonClick.Invoke();
      };

      act.BeginInvoke(nullnull);
    2. 查找列表:
      this.CheckedListBoxColumnNames.FindAll(TreeScope.Descendants,
                          new PropertyCondition(
                              AutomationElement.ControlTypeProperty,
                              ControlType.ListItem));
    3. TogglePattern似乎对CheckListBox不起作用, 可用如下代码代替:
      item.SetFocus();
      SendKeys.SendWait(" ");  // Send a {SPACE} to check the checkbox.
  • 相关阅读:
    iframeUpload
    获取当前文件路径。
    ie6 overflow 失效
    ie8 vml不显示
    json转换
    nodejs for windows
    模块化管理组件(2012/05/09)
    模块化管理组件v0.1
    Firefox和IE之间7个JavaScript的差异
    c输入函数细节
  • 原文地址:https://www.cnblogs.com/mrfangzheng/p/1650939.html
Copyright © 2011-2022 走看看