donobu 5.56.0 → 5.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/GptConfigsApi.d.ts +5 -5
- package/dist/apis/GptConfigsApi.js +14 -14
- package/dist/bindings/PageInteractionTracker.d.ts +1 -1
- package/dist/bindings/PageInteractionTracker.js +3 -3
- package/dist/bindings/SetDonobuAnnotations.d.ts +1 -1
- package/dist/bindings/SetDonobuAnnotations.js +3 -3
- package/dist/clients/AnthropicGptClient.d.ts +2 -2
- package/dist/clients/AnthropicGptClient.js +77 -77
- package/dist/clients/OpenAiGptClient.d.ts +14 -14
- package/dist/clients/OpenAiGptClient.js +183 -183
- package/dist/esm/apis/GptConfigsApi.d.ts +5 -5
- package/dist/esm/apis/GptConfigsApi.js +14 -14
- package/dist/esm/bindings/PageInteractionTracker.d.ts +1 -1
- package/dist/esm/bindings/PageInteractionTracker.js +3 -3
- package/dist/esm/bindings/SetDonobuAnnotations.d.ts +1 -1
- package/dist/esm/bindings/SetDonobuAnnotations.js +3 -3
- package/dist/esm/clients/AnthropicGptClient.d.ts +2 -2
- package/dist/esm/clients/AnthropicGptClient.js +77 -77
- package/dist/esm/clients/OpenAiGptClient.d.ts +14 -14
- package/dist/esm/clients/OpenAiGptClient.js +183 -183
- package/dist/esm/lib/ai/PageAi.js +2 -1
- package/dist/esm/lib/page/extendPage.js +2 -1
- package/dist/esm/lib/test/utils/TestFileUpdater.d.ts +9 -9
- package/dist/esm/lib/test/utils/TestFileUpdater.js +49 -49
- package/dist/esm/main.d.ts +2 -0
- package/dist/esm/managers/AdminApiController.d.ts +16 -16
- package/dist/esm/managers/AdminApiController.js +35 -35
- package/dist/esm/managers/DonobuFlow.d.ts +41 -33
- package/dist/esm/managers/DonobuFlow.js +362 -532
- package/dist/esm/managers/DonobuFlowsManager.js +2 -10
- package/dist/esm/managers/FlowDependencyAnalyzer.d.ts +12 -12
- package/dist/esm/managers/FlowDependencyAnalyzer.js +77 -77
- package/dist/esm/managers/PageInspector.d.ts +38 -38
- package/dist/esm/managers/PageInspector.js +745 -745
- package/dist/esm/managers/TargetInspector.d.ts +28 -33
- package/dist/esm/managers/TestsManager.d.ts +25 -25
- package/dist/esm/managers/TestsManager.js +74 -74
- package/dist/esm/managers/ToolManager.js +7 -5
- package/dist/esm/managers/ToolRegistry.d.ts +5 -1
- package/dist/esm/managers/WebTargetInspector.d.ts +9 -5
- package/dist/esm/managers/WebTargetInspector.js +45 -47
- package/dist/esm/models/AiQuery.d.ts +29 -15
- package/dist/esm/models/AiQuery.js +31 -0
- package/dist/esm/models/InteractableElement.d.ts +6 -0
- package/dist/esm/models/InteractableElement.js +7 -1
- package/dist/esm/models/Observation.d.ts +38 -0
- package/dist/esm/models/Observation.js +3 -0
- package/dist/esm/models/ToolCallContext.d.ts +3 -2
- package/dist/esm/persistence/flows/FlowsPersistenceDonobuApi.d.ts +2 -2
- package/dist/esm/persistence/flows/FlowsPersistenceDonobuApi.js +19 -18
- package/dist/esm/persistence/flows/FlowsPersistenceSqlite.js +2 -1
- package/dist/esm/targets/TargetProvider.d.ts +110 -0
- package/dist/esm/targets/TargetProvider.js +25 -0
- package/dist/esm/targets/TargetRuntime.d.ts +6 -3
- package/dist/esm/targets/WebDialogHandler.d.ts +14 -0
- package/dist/esm/targets/WebDialogHandler.js +198 -0
- package/dist/esm/targets/WebTargetProvider.d.ts +32 -0
- package/dist/esm/targets/WebTargetProvider.js +136 -0
- package/dist/esm/targets/WebTargetRuntime.d.ts +2 -2
- package/dist/esm/targets/WebTargetRuntime.js +2 -1
- package/dist/esm/tools/AssertPageTool.d.ts +1 -1
- package/dist/esm/tools/AssertPageTool.js +3 -3
- package/dist/esm/tools/DetectBrokenLinksTool.d.ts +2 -2
- package/dist/esm/tools/DetectBrokenLinksTool.js +44 -44
- package/dist/esm/tools/InputFakerTool.d.ts +4 -4
- package/dist/esm/tools/InputFakerTool.js +10 -10
- package/dist/esm/tools/InputTextTool.d.ts +4 -4
- package/dist/esm/tools/InputTextTool.js +7 -7
- package/dist/esm/tools/ReplayableInteraction.d.ts +34 -34
- package/dist/esm/tools/ReplayableInteraction.js +245 -245
- package/dist/esm/utils/BrowserUtils.d.ts +19 -19
- package/dist/esm/utils/BrowserUtils.js +57 -57
- package/dist/esm/utils/MiscUtils.d.ts +2 -2
- package/dist/esm/utils/MiscUtils.js +16 -16
- package/dist/esm/utils/PlaywrightUtils.d.ts +1 -1
- package/dist/esm/utils/TargetUtils.d.ts +1 -1
- package/dist/esm/utils/TargetUtils.js +15 -13
- package/dist/lib/ai/PageAi.js +2 -1
- package/dist/lib/page/extendPage.js +2 -1
- package/dist/lib/test/utils/TestFileUpdater.d.ts +9 -9
- package/dist/lib/test/utils/TestFileUpdater.js +49 -49
- package/dist/main.d.ts +2 -0
- package/dist/managers/AdminApiController.d.ts +16 -16
- package/dist/managers/AdminApiController.js +35 -35
- package/dist/managers/DonobuFlow.d.ts +41 -33
- package/dist/managers/DonobuFlow.js +362 -532
- package/dist/managers/DonobuFlowsManager.js +2 -10
- package/dist/managers/FlowDependencyAnalyzer.d.ts +12 -12
- package/dist/managers/FlowDependencyAnalyzer.js +77 -77
- package/dist/managers/PageInspector.d.ts +38 -38
- package/dist/managers/PageInspector.js +745 -745
- package/dist/managers/TargetInspector.d.ts +28 -33
- package/dist/managers/TestsManager.d.ts +25 -25
- package/dist/managers/TestsManager.js +74 -74
- package/dist/managers/ToolManager.js +7 -5
- package/dist/managers/ToolRegistry.d.ts +5 -1
- package/dist/managers/WebTargetInspector.d.ts +9 -5
- package/dist/managers/WebTargetInspector.js +45 -47
- package/dist/models/AiQuery.d.ts +29 -15
- package/dist/models/AiQuery.js +31 -0
- package/dist/models/InteractableElement.d.ts +6 -0
- package/dist/models/InteractableElement.js +7 -1
- package/dist/models/Observation.d.ts +38 -0
- package/dist/models/Observation.js +3 -0
- package/dist/models/ToolCallContext.d.ts +3 -2
- package/dist/persistence/flows/FlowsPersistenceDonobuApi.d.ts +2 -2
- package/dist/persistence/flows/FlowsPersistenceDonobuApi.js +19 -18
- package/dist/persistence/flows/FlowsPersistenceSqlite.js +2 -1
- package/dist/targets/TargetProvider.d.ts +110 -0
- package/dist/targets/TargetProvider.js +25 -0
- package/dist/targets/TargetRuntime.d.ts +6 -3
- package/dist/targets/WebDialogHandler.d.ts +14 -0
- package/dist/targets/WebDialogHandler.js +198 -0
- package/dist/targets/WebTargetProvider.d.ts +32 -0
- package/dist/targets/WebTargetProvider.js +136 -0
- package/dist/targets/WebTargetRuntime.d.ts +2 -2
- package/dist/targets/WebTargetRuntime.js +2 -1
- package/dist/tools/AssertPageTool.d.ts +1 -1
- package/dist/tools/AssertPageTool.js +3 -3
- package/dist/tools/DetectBrokenLinksTool.d.ts +2 -2
- package/dist/tools/DetectBrokenLinksTool.js +44 -44
- package/dist/tools/InputFakerTool.d.ts +4 -4
- package/dist/tools/InputFakerTool.js +10 -10
- package/dist/tools/InputTextTool.d.ts +4 -4
- package/dist/tools/InputTextTool.js +7 -7
- package/dist/tools/ReplayableInteraction.d.ts +34 -34
- package/dist/tools/ReplayableInteraction.js +245 -245
- package/dist/utils/BrowserUtils.d.ts +19 -19
- package/dist/utils/BrowserUtils.js +57 -57
- package/dist/utils/MiscUtils.d.ts +2 -2
- package/dist/utils/MiscUtils.js +16 -16
- package/dist/utils/PlaywrightUtils.d.ts +1 -1
- package/dist/utils/TargetUtils.d.ts +1 -1
- package/dist/utils/TargetUtils.js +15 -13
- package/package.json +2 -1
|
@@ -195,7 +195,7 @@ class DonobuFlowsManager {
|
|
|
195
195
|
};
|
|
196
196
|
const flowsPersistence = await this.resolveLayerForFlowCreate(flowParams.testId ?? null);
|
|
197
197
|
const envData = await this.envDataManager.getByNames(flowMetadata.envVars ?? []);
|
|
198
|
-
const donobuFlow = new DonobuFlow_1.DonobuFlow(this, envData, flowsPersistence, gptClientData.gptClient, toolManager, interactionVisualizer, toolCallsOnStart, [], [], targetRuntime.
|
|
198
|
+
const donobuFlow = new DonobuFlow_1.DonobuFlow(this, envData, flowsPersistence, gptClientData.gptClient, toolManager, interactionVisualizer, toolCallsOnStart, [], [], targetRuntime.provider, flowMetadata, targetRuntime.controlPanel);
|
|
199
199
|
await flowsPersistence.setFlowMetadata(flowMetadata);
|
|
200
200
|
const flowHandle = {
|
|
201
201
|
donobuFlow: donobuFlow,
|
|
@@ -453,15 +453,7 @@ class DonobuFlowsManager {
|
|
|
453
453
|
? this.flowRuntime.get(flowId)
|
|
454
454
|
: null;
|
|
455
455
|
if (activeFlowHandle) {
|
|
456
|
-
activeFlowHandle.donobuFlow.
|
|
457
|
-
// If the target is still connected, cancel will cause the flow to fail
|
|
458
|
-
// on its next iteration. For web flows, close the browser context.
|
|
459
|
-
if (activeFlowHandle.donobuFlow.targetInspector.connected) {
|
|
460
|
-
const target = activeFlowHandle.donobuFlow.targetInspector.target;
|
|
461
|
-
if (target.type === 'web' && target.current) {
|
|
462
|
-
await target.current.context().close();
|
|
463
|
-
}
|
|
464
|
-
}
|
|
456
|
+
await activeFlowHandle.donobuFlow.cancel();
|
|
465
457
|
return activeFlowHandle.donobuFlow.metadata;
|
|
466
458
|
}
|
|
467
459
|
return await this.getFlowById(flowId);
|
|
@@ -11,23 +11,11 @@ export declare class FlowDependencyAnalyzer {
|
|
|
11
11
|
* Analyzes a collection of flows and builds a dependency graph based on browser state references.
|
|
12
12
|
*/
|
|
13
13
|
static analyzeDependencies(flows: FlowMetadata[]): DependencyGraph;
|
|
14
|
-
/**
|
|
15
|
-
* Extracts dependencies for a single flow by analyzing its browser.initialState
|
|
16
|
-
*/
|
|
17
|
-
private static extractDependencies;
|
|
18
14
|
/**
|
|
19
15
|
* Determines if a new flow should replace an existing flow when they have the same name.
|
|
20
16
|
* Prefers flows with later completedAt times, treating null completedAt as "never completed".
|
|
21
17
|
*/
|
|
22
18
|
static shouldReplaceFlow(existingFlow: FlowMetadata, newFlow: FlowMetadata): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Detects circular dependencies using DFS
|
|
25
|
-
*/
|
|
26
|
-
private static detectCircularDependencies;
|
|
27
|
-
/**
|
|
28
|
-
* Calculates execution order using topological sort with parallel execution support
|
|
29
|
-
*/
|
|
30
|
-
private static calculateExecutionOrder;
|
|
31
19
|
/**
|
|
32
20
|
* Validates that all flow dependencies can be resolved
|
|
33
21
|
*/
|
|
@@ -36,5 +24,17 @@ export declare class FlowDependencyAnalyzer {
|
|
|
36
24
|
* Gets a human-readable summary of the dependency graph
|
|
37
25
|
*/
|
|
38
26
|
static getDependencySummary(graph: DependencyGraph): string;
|
|
27
|
+
/**
|
|
28
|
+
* Extracts dependencies for a single flow by analyzing its browser.initialState
|
|
29
|
+
*/
|
|
30
|
+
private static extractDependencies;
|
|
31
|
+
/**
|
|
32
|
+
* Detects circular dependencies using DFS
|
|
33
|
+
*/
|
|
34
|
+
private static detectCircularDependencies;
|
|
35
|
+
/**
|
|
36
|
+
* Calculates execution order using topological sort with parallel execution support
|
|
37
|
+
*/
|
|
38
|
+
private static calculateExecutionOrder;
|
|
39
39
|
}
|
|
40
40
|
//# sourceMappingURL=FlowDependencyAnalyzer.d.ts.map
|
|
@@ -61,6 +61,83 @@ class FlowDependencyAnalyzer {
|
|
|
61
61
|
executionOrder,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Determines if a new flow should replace an existing flow when they have the same name.
|
|
66
|
+
* Prefers flows with later completedAt times, treating null completedAt as "never completed".
|
|
67
|
+
*/
|
|
68
|
+
static shouldReplaceFlow(existingFlow, newFlow) {
|
|
69
|
+
// If both flows have completedAt values, prefer the later one
|
|
70
|
+
if (existingFlow.completedAt !== null && newFlow.completedAt !== null) {
|
|
71
|
+
return newFlow.completedAt > existingFlow.completedAt;
|
|
72
|
+
}
|
|
73
|
+
// If only the new flow has a completedAt value, prefer it
|
|
74
|
+
if (existingFlow.completedAt === null && newFlow.completedAt !== null) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
// If only the existing flow has a completedAt value, keep it
|
|
78
|
+
if (existingFlow.completedAt !== null && newFlow.completedAt === null) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
// If neither has completedAt, prefer the one with the later startedAt
|
|
82
|
+
// (this handles flows that are still running or were interrupted)
|
|
83
|
+
if (existingFlow.startedAt !== null && newFlow.startedAt !== null) {
|
|
84
|
+
return newFlow.startedAt > existingFlow.startedAt;
|
|
85
|
+
}
|
|
86
|
+
// If only the new flow has startedAt, prefer it
|
|
87
|
+
if (existingFlow.startedAt === null && newFlow.startedAt !== null) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
// If only the existing flow has startedAt, keep it
|
|
91
|
+
if (existingFlow.startedAt !== null && newFlow.startedAt === null) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
// If we can't determine based on timestamps, keep the existing flow
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Validates that all flow dependencies can be resolved
|
|
99
|
+
*/
|
|
100
|
+
static validateDependencies(flows) {
|
|
101
|
+
try {
|
|
102
|
+
this.analyzeDependencies(flows);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
throw new Error(`Flow dependency validation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Gets a human-readable summary of the dependency graph
|
|
110
|
+
*/
|
|
111
|
+
static getDependencySummary(graph) {
|
|
112
|
+
const lines = [];
|
|
113
|
+
lines.push(`Flow Dependency Analysis:`);
|
|
114
|
+
lines.push(`- Total flows: ${graph.flows.size}`);
|
|
115
|
+
lines.push(`- Independent flows: ${graph.independentFlows.length}`);
|
|
116
|
+
lines.push(`- Execution waves: ${graph.executionOrder.length}`);
|
|
117
|
+
lines.push('');
|
|
118
|
+
lines.push('Execution Order:');
|
|
119
|
+
graph.executionOrder.forEach((wave, index) => {
|
|
120
|
+
const waveNames = wave.map((flowId) => {
|
|
121
|
+
const flow = graph.flows.get(flowId);
|
|
122
|
+
return flow?.name || flowId;
|
|
123
|
+
});
|
|
124
|
+
lines.push(` Wave ${index + 1}: ${waveNames.join(', ')}`);
|
|
125
|
+
});
|
|
126
|
+
lines.push('');
|
|
127
|
+
lines.push('Dependencies:');
|
|
128
|
+
graph.dependencies.forEach((deps, flowId) => {
|
|
129
|
+
if (deps.length > 0) {
|
|
130
|
+
const flow = graph.flows.get(flowId);
|
|
131
|
+
const flowName = flow?.name || flowId;
|
|
132
|
+
const depNames = deps.map((depId) => {
|
|
133
|
+
const depFlow = graph.flows.get(depId);
|
|
134
|
+
return depFlow?.name || depId;
|
|
135
|
+
});
|
|
136
|
+
lines.push(` ${flowName} depends on: ${depNames.join(', ')}`);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return lines.join('\n');
|
|
140
|
+
}
|
|
64
141
|
/**
|
|
65
142
|
* Extracts dependencies for a single flow by analyzing its browser.initialState
|
|
66
143
|
*/
|
|
@@ -102,39 +179,6 @@ class FlowDependencyAnalyzer {
|
|
|
102
179
|
throw new Error(`Unknown browser state reference type: ${initialState.type}`);
|
|
103
180
|
}
|
|
104
181
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Determines if a new flow should replace an existing flow when they have the same name.
|
|
107
|
-
* Prefers flows with later completedAt times, treating null completedAt as "never completed".
|
|
108
|
-
*/
|
|
109
|
-
static shouldReplaceFlow(existingFlow, newFlow) {
|
|
110
|
-
// If both flows have completedAt values, prefer the later one
|
|
111
|
-
if (existingFlow.completedAt !== null && newFlow.completedAt !== null) {
|
|
112
|
-
return newFlow.completedAt > existingFlow.completedAt;
|
|
113
|
-
}
|
|
114
|
-
// If only the new flow has a completedAt value, prefer it
|
|
115
|
-
if (existingFlow.completedAt === null && newFlow.completedAt !== null) {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
// If only the existing flow has a completedAt value, keep it
|
|
119
|
-
if (existingFlow.completedAt !== null && newFlow.completedAt === null) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
// If neither has completedAt, prefer the one with the later startedAt
|
|
123
|
-
// (this handles flows that are still running or were interrupted)
|
|
124
|
-
if (existingFlow.startedAt !== null && newFlow.startedAt !== null) {
|
|
125
|
-
return newFlow.startedAt > existingFlow.startedAt;
|
|
126
|
-
}
|
|
127
|
-
// If only the new flow has startedAt, prefer it
|
|
128
|
-
if (existingFlow.startedAt === null && newFlow.startedAt !== null) {
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
// If only the existing flow has startedAt, keep it
|
|
132
|
-
if (existingFlow.startedAt !== null && newFlow.startedAt === null) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
// If we can't determine based on timestamps, keep the existing flow
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
182
|
/**
|
|
139
183
|
* Detects circular dependencies using DFS
|
|
140
184
|
*/
|
|
@@ -198,50 +242,6 @@ class FlowDependencyAnalyzer {
|
|
|
198
242
|
}
|
|
199
243
|
return executionOrder;
|
|
200
244
|
}
|
|
201
|
-
/**
|
|
202
|
-
* Validates that all flow dependencies can be resolved
|
|
203
|
-
*/
|
|
204
|
-
static validateDependencies(flows) {
|
|
205
|
-
try {
|
|
206
|
-
this.analyzeDependencies(flows);
|
|
207
|
-
}
|
|
208
|
-
catch (error) {
|
|
209
|
-
throw new Error(`Flow dependency validation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Gets a human-readable summary of the dependency graph
|
|
214
|
-
*/
|
|
215
|
-
static getDependencySummary(graph) {
|
|
216
|
-
const lines = [];
|
|
217
|
-
lines.push(`Flow Dependency Analysis:`);
|
|
218
|
-
lines.push(`- Total flows: ${graph.flows.size}`);
|
|
219
|
-
lines.push(`- Independent flows: ${graph.independentFlows.length}`);
|
|
220
|
-
lines.push(`- Execution waves: ${graph.executionOrder.length}`);
|
|
221
|
-
lines.push('');
|
|
222
|
-
lines.push('Execution Order:');
|
|
223
|
-
graph.executionOrder.forEach((wave, index) => {
|
|
224
|
-
const waveNames = wave.map((flowId) => {
|
|
225
|
-
const flow = graph.flows.get(flowId);
|
|
226
|
-
return flow?.name || flowId;
|
|
227
|
-
});
|
|
228
|
-
lines.push(` Wave ${index + 1}: ${waveNames.join(', ')}`);
|
|
229
|
-
});
|
|
230
|
-
lines.push('');
|
|
231
|
-
lines.push('Dependencies:');
|
|
232
|
-
graph.dependencies.forEach((deps, flowId) => {
|
|
233
|
-
if (deps.length > 0) {
|
|
234
|
-
const flow = graph.flows.get(flowId);
|
|
235
|
-
const flowName = flow?.name || flowId;
|
|
236
|
-
const depNames = deps.map((depId) => {
|
|
237
|
-
const depFlow = graph.flows.get(depId);
|
|
238
|
-
return depFlow?.name || depId;
|
|
239
|
-
});
|
|
240
|
-
lines.push(` ${flowName} depends on: ${depNames.join(', ')}`);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
return lines.join('\n');
|
|
244
|
-
}
|
|
245
245
|
}
|
|
246
246
|
exports.FlowDependencyAnalyzer = FlowDependencyAnalyzer;
|
|
247
247
|
//# sourceMappingURL=FlowDependencyAnalyzer.js.map
|
|
@@ -60,6 +60,44 @@ export declare class PageInspector {
|
|
|
60
60
|
* run in the browser context before calling this class's methods.
|
|
61
61
|
*/
|
|
62
62
|
constructor(interactableElementAttribute?: string, interactableAnnotationAttribute?: string);
|
|
63
|
+
/**
|
|
64
|
+
* Converts an HTML attribute to a JavaScript attribute. For example,
|
|
65
|
+
* "data-foo-bar" is turned into "fooBar". Notice the dropping of the "data-"
|
|
66
|
+
* prefix, and the conversion from kebab-case to camelCase.
|
|
67
|
+
*/
|
|
68
|
+
static convertToJsAttribute(htmlAttribute: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* An internal method that is injected into page/frame contexts to find and attribute interactable elements.
|
|
71
|
+
*
|
|
72
|
+
* This method:
|
|
73
|
+
* 1. Identifies potentially interactable elements using a comprehensive selector
|
|
74
|
+
* 2. Filters elements based on visibility, position in viewport, and interactability
|
|
75
|
+
* 3. Assigns unique sequential numeric values to the interactable attribute
|
|
76
|
+
*
|
|
77
|
+
* The method uses several criteria to determine if an element is truly interactable:
|
|
78
|
+
* - Element must be visible (non-zero dimensions, not hidden via CSS)
|
|
79
|
+
* - Element must have at least 50% of its area within the viewport
|
|
80
|
+
* - Element must not be disabled, inert, or have pointer-events:none
|
|
81
|
+
* - Element must be the topmost element at its coordinates (using point sampling)
|
|
82
|
+
*
|
|
83
|
+
* Special handling is provided for label elements, which will attribute their
|
|
84
|
+
* associated form controls as well.
|
|
85
|
+
*
|
|
86
|
+
* This method can process both standard DOM elements and elements within shadow roots,
|
|
87
|
+
* ensuring thorough coverage of modern web applications.
|
|
88
|
+
*
|
|
89
|
+
* @param arg - A tuple containing [offset: number, interactableAttribute: string]
|
|
90
|
+
* where offset is the starting value for sequential numbering and
|
|
91
|
+
* interactableAttribute is the attribute name to assign
|
|
92
|
+
* @returns The updated offset after assigning attributes (for sequential numbering across frames)
|
|
93
|
+
* @private
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* This method is designed to be injected into the page context using page.evaluate()
|
|
97
|
+
* and should not be called directly from Node.js code.
|
|
98
|
+
*/
|
|
99
|
+
private static attributeElementsInContext;
|
|
100
|
+
private static frameFilter;
|
|
63
101
|
/**
|
|
64
102
|
* Assigns a globally unique attribute to all visible and interactable elements in the page.
|
|
65
103
|
*
|
|
@@ -215,43 +253,5 @@ export declare class PageInspector {
|
|
|
215
253
|
* // htmlSnippet = "<button type=\"submit\">Submit</button>"
|
|
216
254
|
*/
|
|
217
255
|
getHtmlSnippet(elementHandle: ElementHandle<HTMLElement | SVGElement>): Promise<string>;
|
|
218
|
-
/**
|
|
219
|
-
* Converts an HTML attribute to a JavaScript attribute. For example,
|
|
220
|
-
* "data-foo-bar" is turned into "fooBar". Notice the dropping of the "data-"
|
|
221
|
-
* prefix, and the conversion from kebab-case to camelCase.
|
|
222
|
-
*/
|
|
223
|
-
static convertToJsAttribute(htmlAttribute: string): string;
|
|
224
|
-
/**
|
|
225
|
-
* An internal method that is injected into page/frame contexts to find and attribute interactable elements.
|
|
226
|
-
*
|
|
227
|
-
* This method:
|
|
228
|
-
* 1. Identifies potentially interactable elements using a comprehensive selector
|
|
229
|
-
* 2. Filters elements based on visibility, position in viewport, and interactability
|
|
230
|
-
* 3. Assigns unique sequential numeric values to the interactable attribute
|
|
231
|
-
*
|
|
232
|
-
* The method uses several criteria to determine if an element is truly interactable:
|
|
233
|
-
* - Element must be visible (non-zero dimensions, not hidden via CSS)
|
|
234
|
-
* - Element must have at least 50% of its area within the viewport
|
|
235
|
-
* - Element must not be disabled, inert, or have pointer-events:none
|
|
236
|
-
* - Element must be the topmost element at its coordinates (using point sampling)
|
|
237
|
-
*
|
|
238
|
-
* Special handling is provided for label elements, which will attribute their
|
|
239
|
-
* associated form controls as well.
|
|
240
|
-
*
|
|
241
|
-
* This method can process both standard DOM elements and elements within shadow roots,
|
|
242
|
-
* ensuring thorough coverage of modern web applications.
|
|
243
|
-
*
|
|
244
|
-
* @param arg - A tuple containing [offset: number, interactableAttribute: string]
|
|
245
|
-
* where offset is the starting value for sequential numbering and
|
|
246
|
-
* interactableAttribute is the attribute name to assign
|
|
247
|
-
* @returns The updated offset after assigning attributes (for sequential numbering across frames)
|
|
248
|
-
* @private
|
|
249
|
-
*
|
|
250
|
-
* @remarks
|
|
251
|
-
* This method is designed to be injected into the page context using page.evaluate()
|
|
252
|
-
* and should not be called directly from Node.js code.
|
|
253
|
-
*/
|
|
254
|
-
private static attributeElementsInContext;
|
|
255
|
-
private static frameFilter;
|
|
256
256
|
}
|
|
257
257
|
//# sourceMappingURL=PageInspector.d.ts.map
|