window自动化分类:1.新增选择窗口(inspect),支持高亮指定元素,并查看元素的名称、类型、句柄、xpath等各项属性及所在窗口各项属性 2.新增界面自动化,支持通过xpath、name、id等条件在对指定元素执行点击、设置值、模拟输入、高亮等操作

This commit is contained in:
fofolee
2025-01-17 18:51:11 +08:00
parent 61d711765b
commit 10b67c919a
11 changed files with 2203 additions and 2110 deletions

View File

@@ -316,13 +316,20 @@ public class WindowManager
GetWindowText(hwnd, title, title.Capacity);
GetClassName(hwnd, className, className.Capacity);
// 获取窗口位置和大小
RECT rect = new RECT();
GetWindowRect(hwnd, out rect);
// 获取进程信息
uint processId = 0;
GetWindowThreadProcessId(hwnd, out processId);
string processName = "";
string processPath = "";
try
{
var process = Process.GetProcessById((int)processId);
processName = process.ProcessName;
processPath = process.MainModule.FileName;
}
catch { }
@@ -331,7 +338,12 @@ public class WindowManager
{ "handle", hwnd.ToInt64() },
{ "title", title.ToString() },
{ "class", className.ToString() },
{ "process", processName }
{ "x", rect.Left },
{ "y", rect.Top },
{ "width", rect.Right - rect.Left },
{ "height", rect.Bottom - rect.Top },
{ "processName", processName },
{ "processPath", processPath }
};
}