import { CoordinateSet, HashedDomElement, ViewportInfo } from './history_tree_processor/view'; /** * DOM基础节点接口 */ export declare abstract class DOMBaseNode { isVisible: boolean; parent?: DOMElementNode; constructor(isVisible: boolean, parent?: DOMElementNode); } /** * DOM文本节点类 */ export declare class DOMTextNode extends DOMBaseNode { text: string; type: string; constructor(text: string, isVisible: boolean, parent?: DOMElementNode); /** * 检查是否有带有高亮索引的父元素 */ hasParentWithHighlightIndex(): boolean; } /** * DOM元素节点类 * xpath: 从最后一个根节点(shadow root或iframe或document,如果没有shadow root或iframe)的元素的xpath。 * 为了正确引用元素,我们需要递归切换根节点,直到找到元素(使用.parent向上查找树) */ export declare class DOMElementNode extends DOMBaseNode { tagName: string; xpath: string; attributes: Record; children: DOMBaseNode[]; isInteractive: boolean; isTopElement: boolean; shadowRoot: boolean; highlightIndex?: number; viewportCoordinates: CoordinateSet | null; pageCoordinates: CoordinateSet | null; viewportInfo: ViewportInfo | null; get index(): number; get tag(): string; get text(): string; get isClickable(): boolean; get isInput(): boolean; constructor(tagName: string, xpath: string, attributes: Record, children: DOMBaseNode[], isVisible: boolean, isInteractive?: boolean, isTopElement?: boolean, shadowRoot?: boolean, highlightIndex?: number, viewportCoordinates?: CoordinateSet | null, pageCoordinates?: CoordinateSet | null, viewportInfo?: ViewportInfo | null, parent?: DOMElementNode); /** * 生成节点的字符串表示 */ toString(): string; /** * 获取节点的哈希值 * 注意:使用转换为DOMTreeElement的方式来获取哈希 */ get hash(): HashedDomElement; /** * 获取直到下一个可点击元素的所有文本 */ getAllTextTillNextClickableElement(maxDepth?: number): string; /** * 将可点击元素转换为字符串 */ clickableElementsToString(includeAttributes?: string[]): string; /** * 获取文件上传元素 */ getFileUploadElement(checkSiblings?: boolean): DOMElementNode | null; /** * 获取高级CSS选择器 * 注意:这个方法将需要在浏览器上下文中实现 */ getAdvancedCssSelector(): string; } /** * 选择器映射类型 */ export type SelectorMap = Record; /** * DOM状态类 */ export declare class DOMState { elementTree: DOMElementNode; selectorMap: SelectorMap; constructor(elementTree: DOMElementNode, selectorMap: SelectorMap); }