元素操作
使用元素操控,例如word excel 微信 qq 浏览器等
ssf.ElementExt
注意使用ssf.ElementExt先加载元素,比如读取根元素,根元素的意思就是顶层windows桌面
enums.UIProperty 枚举
| 属性名称 | 值 |
|---|---|
| RuntimeId | 30000 |
| BoundingRectangle | 30001 |
| ProcessId | 30002 |
| ControlType | 30003 |
| LocalizedControlType | 30004 |
| Name | 30005 |
| AcceleratorKey | 30006 |
| AccessKey | 30007 |
| HasKeyboardFocus | 30008 |
| IsKeyboardFocusable | 30009 |
| IsEnabled | 30010 |
| AutomationId | 30011 |
| ClassName | 30012 |
| HelpText | 30013 |
| ClickablePoint | 30014 |
| Culture | 30015 |
| IsControlElement | 30016 |
| IsContentElement | 30017 |
| LabeledBy | 30018 |
| IsPassword | 30019 |
| NativeWindowHandle | 30020 |
| ItemType | 30021 |
| IsOffscreen | 30022 |
| Orientation | 30023 |
| FrameworkId | 30024 |
| IsRequiredForForm | 30025 |
| ItemStatus | 30026 |
| IsDockPatternAvailable | 30027 |
| IsExpandCollapsePatternAvailable | 30028 |
| IsGridItemPatternAvailable | 30029 |
| IsGridPatternAvailable | 30030 |
| IsInvokePatternAvailable | 30031 |
| IsMultipleViewPatternAvailable | 30032 |
| IsRangeValuePatternAvailable | 30033 |
| IsScrollPatternAvailable | 30034 |
| IsScrollItemPatternAvailable | 30035 |
| IsSelectionItemPatternAvailable | 30036 |
| IsSelectionPatternAvailable | 30037 |
| IsTablePatternAvailable | 30038 |
| IsTableItemPatternAvailable | 30039 |
| IsTextPatternAvailable | 30040 |
| IsTogglePatternAvailable | 30041 |
| IsTransformPatternAvailable | 30042 |
| IsValuePatternAvailable | 30043 |
| IsWindowPatternAvailable | 30044 |
| ValueValue | 30045 |
| ValueIsReadOnly | 30046 |
| RangeValueValue | 30047 |
| RangeValueIsReadOnly | 30048 |
| RangeValueMinimum | 30049 |
| RangeValueMaximum | 30050 |
| RangeValueLargeChange | 30051 |
| RangeValueSmallChange | 30052 |
| ScrollHorizontalScrollPercent | 30053 |
| ScrollHorizontalViewSize | 30054 |
| ScrollVerticalScrollPercent | 30055 |
| ScrollVerticalViewSize | 30056 |
| ScrollHorizontallyScrollable | 30057 |
| ScrollVerticallyScrollable | 30058 |
| SelectionSelection | 30059 |
| SelectionCanSelectMultiple | 30060 |
| SelectionIsSelectionRequired | 30061 |
| GridRowCount | 30062 |
| GridColumnCount | 30063 |
| GridItemRow | 30064 |
| GridItemColumn | 30065 |
| GridItemRowSpan | 30066 |
| GridItemColumnSpan | 30067 |
| GridItemContainingGrid | 30068 |
| DockDockPosition | 30069 |
| ExpandCollapseExpandCollapseState | 30070 |
| MultipleViewCurrentView | 30071 |
| MultipleViewSupportedViews | 30072 |
| WindowCanMaximize | 30073 |
| WindowCanMinimize | 30074 |
| WindowWindowVisualState | 30075 |
| WindowWindowInteractionState | 30076 |
| WindowIsModal | 30077 |
| WindowIsTopmost | 30078 |
| SelectionItemIsSelected | 30079 |
| SelectionItemSelectionContainer | 30080 |
| TableRowHeaders | 30081 |
| TableColumnHeaders | 30082 |
| TableRowOrColumnMajor | 30083 |
| TableItemRowHeaderItems | 30084 |
| TableItemColumnHeaderItems | 30085 |
| ToggleToggleState | 30086 |
| TransformCanMove | 30087 |
| TransformCanResize | 30088 |
| TransformCanRotate | 30089 |
| IsLegacyIAccessiblePatternAvailable | 30090 |
| LegacyIAccessibleChildId | 30091 |
| LegacyIAccessibleName | 30092 |
| LegacyIAccessibleValue | 30093 |
| LegacyIAccessibleDescription | 30094 |
| LegacyIAccessibleRole | 30095 |
| LegacyIAccessibleState | 30096 |
| LegacyIAccessibleHelp | 30097 |
| LegacyIAccessibleKeyboardShortcut | 30098 |
| LegacyIAccessibleSelection | 30099 |
| LegacyIAccessibleDefaultAction | 30100 |
| AriaRole | 30101 |
| AriaProperties | 30102 |
| IsDataValidForForm | 30103 |
| ControllerFor | 30104 |
| DescribedBy | 30105 |
| FlowsTo | 30106 |
| ProviderDescription | 30107 |
| IsItemContainerPatternAvailable | 30108 |
| IsVirtualizedItemPatternAvailable | 30109 |
| IsSynchronizedInputPatternAvailable | 30110 |
| OptimizeForVisualContent | 30111 |
| IsObjectModelPatternAvailable | 30112 |
| AnnotationAnnotationTypeId | 30113 |
| AnnotationAnnotationTypeName | 30114 |
| AnnotationAuthor | 30115 |
| AnnotationDateTime | 30116 |
| AnnotationTarget | 30117 |
| IsAnnotationPatternAvailable | 30118 |
| IsTextPattern2Available | 30119 |
| StylesStyleId | 30120 |
| StylesStyleName | 30121 |
| StylesFillColor | 30122 |
| StylesFillPatternStyle | 30123 |
| StylesShape | 30124 |
| StylesFillPatternColor | 30125 |
| StylesExtendedProperties | 30126 |
| IsStylesPatternAvailable | 30127 |
| IsSpreadsheetPatternAvailable | 30128 |
| SpreadsheetItemFormula | 30129 |
| SpreadsheetItemAnnotationObjects | 30130 |
| SpreadsheetItemAnnotationTypes | 30131 |
| IsSpreadsheetItemPatternAvailable | 30132 |
| Transform2CanZoom | 30133 |
| IsTransformPattern2Available | 30134 |
| LiveSetting | 30135 |
| IsTextChildPatternAvailable | 30136 |
| IsDragPatternAvailable | 30137 |
| DragIsGrabbed | 30138 |
| DragDropEffect | 30139 |
| DragDropEffects | 30140 |
| IsDropTargetPatternAvailable | 30141 |
| DropTargetDropTargetEffect | 30142 |
| DropTargetDropTargetEffects | 30143 |
| DragGrabbedItems | 30144 |
| Transform2ZoomLevel | 30145 |
| Transform2ZoomMinimum | 30146 |
| Transform2ZoomMaximum | 30147 |
| FlowsFrom | 30148 |
| IsTextEditPatternAvailable | 30149 |
| IsPeripheral | 30150 |
| IsCustomNavigationPatternAvailable | 30151 |
| PositionInSet | 30152 |
| SizeOfSet | 30153 |
| Level | 30154 |
| AnnotationTypes | 30155 |
| AnnotationObjects | 30156 |
| LandmarkType | 30157 |
| LocalizedLandmarkType | 30158 |
| FullDescription | 30159 |
| FillColor | 30160 |
| OutlineColor | 30161 |
| FillType | 30162 |
| VisualEffects | 30163 |
| OutlineThickness | 30164 |
| CenterPoint | 30165 |
| Rotation | 30166 |
| Size | 30167 |
| IsSelectionPattern2Available | 30168 |
| Selection2FirstSelectedItem | 30169 |
| Selection2LastSelectedItem | 30170 |
| Selection2CurrentSelectedItem | 30171 |
| Selection2ItemCount | 30172 |
| HeadingLevel | 30173 |
| IsDialog | 30174 |
Rect 接口
| 属性名称 | 类型 | 描述 |
|---|---|---|
| x | number | 元素的 x 坐标 |
| y | number | 元素的 y 坐标 |
| w | number | 元素的宽度 |
| h | number | 元素的高度 |
Point 接口
| 属性名称 | 类型 | 描述 |
|---|---|---|
| x | number | 点的 x 坐标 |
| y | number | 点的 y 坐标 |
希望这些表格形式的信息对您有所帮助!如果有任何进一步的问题或需要更多的信息,请随时告诉我。
PathInfo 接口
| 字段名 | 类型 | 描述 |
|---|---|---|
| main_title | String | 主窗口标题 |
| main_class_name | String | 主窗口类名 |
| main_hwnd | number | 主窗口句柄 |
| pid | number | 进程ID |
| xpath | String | 元素XPath路径 |
| app_path | String | 应用程序路径 |
| title | String | 当前元素标题 |
| class_name | String | 当前元素类名 |
| bounding_rectangle | Rect | 当前元素边界矩形 |
| automation_id | String | 当前元素自动化ID |
| framework_id | String | 当前元素框架ID |
| control_type | String | 控件类型 |
| catch_type | String | 抓取类型 |
好的,下面是重新格式化的 WinElement 接口和 ElementExt 命名空间中的方法,使用了 ### 标记以便于检索。
WinElement 接口
name()
- 返回值:
String - 描述: 获得元素标题
- 示例:
const title = element.name();
value()
- 返回值:
String - 描述: 获得元素值
- 示例:
const value = element.value();
close()
- 返回值:
void - 描述: 关闭元素
- 示例:
element.close();
class_name()
- 返回值:
String - 描述: 获得元素类名
- 示例:
const className = element.class_name();
control_type()
- 返回值:
String - 描述: 获得元素控件类型
- 示例:
const controlType = element.control_type();
childs()
- 返回值:
WinElement[] - 描述: 获得元素所有子元素
- 示例:
const children = element.childs();
parent()
- 返回值:
WinElement - 描述: 获得父元素
- 示例:
const parent = element.parent();
runtime_id()
- 返回值:
number[] - 描述: 获得运行时ID
- 示例:
const runtimeId = element.runtime_id();
automation_id()
- 返回值:
String - 描述: 获得UI ID
- 示例:
const automationId = element.automation_id();
process_id()
- 返回值:
number - 描述: 获得进程ID
- 示例:
const processId = element.process_id();
localized_control_type()
- 返回值:
String - 描述: 获得控件本地化文本名称
- 示例:
const localizedControlType = element.localized_control_type();
accelerator_key()
- 返回值:
String - 描述: 获得快捷键
- 示例:
const acceleratorKey = element.accelerator_key();
has_keyboard_focus()
- 返回值:
Boolean - 描述: 判断元素是否有键盘焦点
- 示例:
const hasFocus = element.has_keyboard_focus();
is_keyboard_focusable()
- 返回值:
Boolean - 描述: 判断元素是否可接收键盘焦点
- 示例:
const focusable = element.is_keyboard_focusable();
is_enabled()
- 返回值:
Boolean - 描述: 判断元素是否可用
- 示例:
const isEnabled = element.is_enabled();
help_text()
- 返回值:
String - 描述: 获得帮助文本
- 示例:
const helpText = element.help_text();
culture()
- 返回值:
number - 描述: 获得区域化标识符
- 示例:
const culture = element.culture();
is_control_element()
- 返回值:
Boolean - 描述: 判断元素是否是控件元素
- 示例:
const isControl = element.is_control_element();