feat: rename include_attributes to includeAttributes
This commit is contained in:
@@ -194,7 +194,7 @@ export class PageController extends EventTarget {
|
|||||||
interactiveBlacklist: blacklist,
|
interactiveBlacklist: blacklist,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.simplifiedHTML = dom.flatTreeToString(this.flatTree, this.config.include_attributes)
|
this.simplifiedHTML = dom.flatTreeToString(this.flatTree, this.config.includeAttributes)
|
||||||
|
|
||||||
this.selectorMap.clear()
|
this.selectorMap.clear()
|
||||||
this.selectorMap = dom.getSelectorMap(this.flatTree)
|
this.selectorMap = dom.getSelectorMap(this.flatTree)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
export interface DomConfig {
|
export interface DomConfig {
|
||||||
interactiveBlacklist?: (Element | (() => Element))[]
|
interactiveBlacklist?: (Element | (() => Element))[]
|
||||||
interactiveWhitelist?: (Element | (() => Element))[]
|
interactiveWhitelist?: (Element | (() => Element))[]
|
||||||
include_attributes?: string[]
|
includeAttributes?: string[]
|
||||||
highlightOpacity?: number
|
highlightOpacity?: number
|
||||||
highlightLabelOpacity?: number
|
highlightLabelOpacity?: number
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ interface TreeNode {
|
|||||||
*
|
*
|
||||||
* @todo 数据脱敏过滤器
|
* @todo 数据脱敏过滤器
|
||||||
*/
|
*/
|
||||||
export function flatTreeToString(flatTree: FlatDomTree, include_attributes?: string[]): string {
|
export function flatTreeToString(flatTree: FlatDomTree, includeAttributes?: string[]): string {
|
||||||
const DEFAULT_INCLUDE_ATTRIBUTES = [
|
const DEFAULT_INCLUDE_ATTRIBUTES = [
|
||||||
'title',
|
'title',
|
||||||
'type',
|
'type',
|
||||||
@@ -146,7 +146,7 @@ export function flatTreeToString(flatTree: FlatDomTree, include_attributes?: str
|
|||||||
'aria-owns',
|
'aria-owns',
|
||||||
]
|
]
|
||||||
|
|
||||||
const includeAttrs = [...(include_attributes || []), ...DEFAULT_INCLUDE_ATTRIBUTES]
|
const includeAttrs = [...(includeAttributes || []), ...DEFAULT_INCLUDE_ATTRIBUTES]
|
||||||
|
|
||||||
// Helper function to cap text length
|
// Helper function to cap text length
|
||||||
const capTextLength = (text: string, maxLength: number): string => {
|
const capTextLength = (text: string, maxLength: number): string => {
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
: 'Elements to force include for interaction',
|
: 'Elements to force include for interaction',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'include_attributes',
|
name: 'includeAttributes',
|
||||||
type: 'string[]',
|
type: 'string[]',
|
||||||
description: isZh
|
description: isZh
|
||||||
? '在 DOM 提取中包含的额外属性'
|
? '在 DOM 提取中包含的额外属性'
|
||||||
|
|||||||
Reference in New Issue
Block a user