tôi có thể xem chế độ xem nhưng không thể xem/nhấn vào nút bên trong. Nút có nhãn trợ năng của UIA_loginview_loginbutton với tính năng accesibility được bật. tại sao nó không hiển thị trên logElementTree()?Tại sao nút của tôi không thể nhìn thấy bằng UIAutomation?
var target = UIATarget.localTarget();
var application = target.frontMostApp();
var window = application.mainWindow();
var view = window.elements().firstWithName("UIA_loginview_view");
UIATarget.localTarget().logElementTree();
UIATarget.localTarget().frontMostApp().logElementTree();
if(view == null || view.toString() == "[object UIAElementNil]")
{
UIALogger.logFail("View not found - "+view.toString());
}
else
{
UIALogger.logPass("View found - "+view.toString());
UIALogger.logMessage("View Elements length - "+view.buttons().length);
view.buttons()["UIA_loginview_loginbutton"].tap();
}
Log tử Tree: // Hiển thị điểm của tôi nhưng không phải là nút bên trong nó
4) UIAElement [tên: UIA_loginview_view giá trị: (null) NSRect: {{0, 20}, {320, 460}}]
bạn có thể vui lòng định dạng mã của mình bằng cách sử dụng {} ở đầu cửa sổ chỉnh sửa - nó giúp ích rất nhiều! – Axel