【问题标题】:In FLAUI trying to Find First Child element that start with some letters在 FLAUI 中尝试查找以某些字母开头的第一个子元素
【发布时间】:2021-06-16 23:05:50
【问题描述】:

在 FLAUI 中,试图获取对以某些字母开头或包含某些字母的子元素的引用。 示例以“DOC”开头或包含“DOC” 我想要做的是我正在打开一些办公文件,如 doc、xls、ppt。 并想在他打开屏幕时附加文件。

      foreach (var file in listOfFiles)
        {
            if (file.Name.Contains("DOC") || file.Name.Contains("PPT") || file.Name.Contains("XLS") || file.Name.Contains("TXT"))
            {                
                file.AsButton().Invoke();
                
                var window = new UIA3Automation();
                desktopWindow = window.GetDesktop();
                desktopWindow = WaitForElement(() => desktopWindow.FindFirstChild(cr => cr.ByName("// Here want to put name that start with ... or contains ...")));
                var app = FlaUI.Core.Application.Attach(desktopWindow.Properties.ProcessId);
                var application = app.GetMainWindow(new UIA3Automation());
                CloseingProcess(application.Name);
                

img

【问题讨论】:

    标签: c# automation flaui


    【解决方案1】:

    如果我理解正确,您想检查一个已经打开的文件是否具有您需要的扩展名。对吗?

    为此,您必须使用FlaUI 控制窗口,然后您可以检查Window 类上的属性.Title,如下所示:

    var automation = new UIA3Automation();
    var app = FlaUI.Core.Application.Attach(application.Process.Id); //attach or start application here
    var window = app.GetMainWindow(automation); //Get hold
    window.Title //Use the .Title or .TitleBar property to check for your extension.
    

    【讨论】:

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