donobu 2.15.1 → 2.17.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/EnvDataApi.d.ts +26 -0
- package/dist/apis/EnvDataApi.d.ts.map +1 -0
- package/dist/apis/EnvDataApi.js +59 -0
- package/dist/apis/EnvDataApi.js.map +1 -0
- package/dist/apis/EnvironmentDataApi.d.ts +26 -0
- package/dist/apis/EnvironmentDataApi.d.ts.map +1 -0
- package/dist/apis/EnvironmentDataApi.js +59 -0
- package/dist/apis/EnvironmentDataApi.js.map +1 -0
- package/dist/apis/FlowsApi.d.ts +4 -0
- package/dist/apis/FlowsApi.d.ts.map +1 -1
- package/dist/apis/FlowsApi.js +26 -2
- package/dist/apis/FlowsApi.js.map +1 -1
- package/dist/apis/FlowsFilesApi.d.ts +1 -1
- package/dist/apis/FlowsFilesApi.d.ts.map +1 -1
- package/dist/apis/SpecialFlowsApi.js +1 -1
- package/dist/apis/SpecialFlowsApi.js.map +1 -1
- package/dist/assets/control-panel.js +30 -3
- package/dist/assets/generated/parameter-schemas.json +51 -37
- package/dist/assets/generated/version +1 -1
- package/dist/assets/interactive-elements-tracker.js +351 -0
- package/dist/assets/page-interactions-tracker.js +39 -20
- package/dist/assets/smart-selector-generator.js +38 -15
- package/dist/bindings/FocusPage.d.ts +6 -1
- package/dist/bindings/FocusPage.d.ts.map +1 -1
- package/dist/bindings/FocusPage.js +2 -8
- package/dist/bindings/FocusPage.js.map +1 -1
- package/dist/bindings/PageInteractionTracker.d.ts +9 -2
- package/dist/bindings/PageInteractionTracker.d.ts.map +1 -1
- package/dist/bindings/PageInteractionTracker.js +27 -3
- package/dist/bindings/PageInteractionTracker.js.map +1 -1
- package/dist/bindings/ProposeToolCall.d.ts +20 -0
- package/dist/bindings/ProposeToolCall.d.ts.map +1 -0
- package/dist/bindings/ProposeToolCall.js +29 -0
- package/dist/bindings/ProposeToolCall.js.map +1 -0
- package/dist/bindings/ToggleDonobuAnnotations.d.ts +5 -2
- package/dist/bindings/ToggleDonobuAnnotations.d.ts.map +1 -1
- package/dist/bindings/ToggleDonobuAnnotations.js +12 -6
- package/dist/bindings/ToggleDonobuAnnotations.js.map +1 -1
- package/dist/esm/apis/EnvDataApi.d.ts +26 -0
- package/dist/esm/apis/EnvDataApi.d.ts.map +1 -0
- package/dist/esm/apis/EnvDataApi.js +59 -0
- package/dist/esm/apis/EnvDataApi.js.map +1 -0
- package/dist/esm/apis/EnvironmentDataApi.d.ts +26 -0
- package/dist/esm/apis/EnvironmentDataApi.d.ts.map +1 -0
- package/dist/esm/apis/EnvironmentDataApi.js +59 -0
- package/dist/esm/apis/EnvironmentDataApi.js.map +1 -0
- package/dist/esm/apis/FlowsApi.d.ts +4 -0
- package/dist/esm/apis/FlowsApi.d.ts.map +1 -1
- package/dist/esm/apis/FlowsApi.js +26 -2
- package/dist/esm/apis/FlowsApi.js.map +1 -1
- package/dist/esm/apis/FlowsFilesApi.d.ts +1 -1
- package/dist/esm/apis/FlowsFilesApi.d.ts.map +1 -1
- package/dist/esm/apis/SpecialFlowsApi.js +1 -1
- package/dist/esm/apis/SpecialFlowsApi.js.map +1 -1
- package/dist/esm/assets/control-panel.js +30 -3
- package/dist/esm/assets/generated/parameter-schemas.json +51 -37
- package/dist/esm/assets/generated/version +1 -1
- package/dist/esm/assets/interactive-elements-tracker.js +351 -0
- package/dist/esm/assets/page-interactions-tracker.js +39 -20
- package/dist/esm/assets/smart-selector-generator.js +38 -15
- package/dist/esm/bindings/FocusPage.d.ts +6 -1
- package/dist/esm/bindings/FocusPage.d.ts.map +1 -1
- package/dist/esm/bindings/FocusPage.js +2 -8
- package/dist/esm/bindings/FocusPage.js.map +1 -1
- package/dist/esm/bindings/PageInteractionTracker.d.ts +9 -2
- package/dist/esm/bindings/PageInteractionTracker.d.ts.map +1 -1
- package/dist/esm/bindings/PageInteractionTracker.js +27 -3
- package/dist/esm/bindings/PageInteractionTracker.js.map +1 -1
- package/dist/esm/bindings/ProposeToolCall.d.ts +20 -0
- package/dist/esm/bindings/ProposeToolCall.d.ts.map +1 -0
- package/dist/esm/bindings/ProposeToolCall.js +29 -0
- package/dist/esm/bindings/ProposeToolCall.js.map +1 -0
- package/dist/esm/bindings/ToggleDonobuAnnotations.d.ts +5 -2
- package/dist/esm/bindings/ToggleDonobuAnnotations.d.ts.map +1 -1
- package/dist/esm/bindings/ToggleDonobuAnnotations.js +12 -6
- package/dist/esm/bindings/ToggleDonobuAnnotations.js.map +1 -1
- package/dist/esm/lib/DonobuExtendedPage.d.ts +106 -0
- package/dist/esm/lib/DonobuExtendedPage.d.ts.map +1 -0
- package/dist/esm/lib/DonobuExtendedPage.js +3 -0
- package/dist/esm/lib/DonobuExtendedPage.js.map +1 -0
- package/dist/esm/lib/constants.d.ts +8 -0
- package/dist/esm/lib/constants.d.ts.map +1 -0
- package/dist/esm/lib/constants.js +14 -0
- package/dist/esm/lib/constants.js.map +1 -0
- package/dist/esm/lib/fixtures/browserState.d.ts +6 -0
- package/dist/esm/lib/fixtures/browserState.d.ts.map +1 -0
- package/dist/esm/lib/fixtures/browserState.js +15 -0
- package/dist/esm/lib/fixtures/browserState.js.map +1 -0
- package/dist/esm/lib/fixtures/gptClients.d.ts +40 -0
- package/dist/esm/lib/fixtures/gptClients.d.ts.map +1 -0
- package/dist/esm/lib/fixtures/gptClients.js +187 -0
- package/dist/esm/lib/fixtures/gptClients.js.map +1 -0
- package/dist/esm/lib/fixtures/testExtension.d.ts +10 -0
- package/dist/esm/lib/fixtures/testExtension.d.ts.map +1 -0
- package/dist/esm/lib/fixtures/testExtension.js +383 -0
- package/dist/esm/lib/fixtures/testExtension.js.map +1 -0
- package/dist/esm/lib/testExtension.d.ts +10 -0
- package/dist/esm/lib/testExtension.d.ts.map +1 -0
- package/dist/esm/lib/testExtension.js +383 -0
- package/dist/esm/lib/testExtension.js.map +1 -0
- package/dist/esm/lib/types.d.ts +106 -0
- package/dist/esm/lib/types.d.ts.map +1 -0
- package/dist/esm/{models/BrowserState.js → lib/types.js} +1 -1
- package/dist/esm/lib/types.js.map +1 -0
- package/dist/esm/lib/utils/donobuTestStack.d.ts +7 -0
- package/dist/esm/lib/utils/donobuTestStack.d.ts.map +1 -0
- package/dist/esm/lib/utils/donobuTestStack.js +31 -0
- package/dist/esm/lib/utils/donobuTestStack.js.map +1 -0
- package/dist/esm/lib/utils/selfHealing.d.ts +15 -0
- package/dist/esm/lib/utils/selfHealing.d.ts.map +1 -0
- package/dist/esm/lib/utils/selfHealing.js +89 -0
- package/dist/esm/lib/utils/selfHealing.js.map +1 -0
- package/dist/esm/main.d.ts +5 -1
- package/dist/esm/main.d.ts.map +1 -1
- package/dist/esm/main.js +8 -5
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/managers/AdminApiController.d.ts.map +1 -1
- package/dist/esm/managers/AdminApiController.js +7 -0
- package/dist/esm/managers/AdminApiController.js.map +1 -1
- package/dist/esm/managers/AgentsManager.d.ts +1 -1
- package/dist/esm/managers/AgentsManager.d.ts.map +1 -1
- package/dist/esm/managers/CodeGenerator.d.ts.map +1 -1
- package/dist/esm/managers/CodeGenerator.js +2 -1
- package/dist/esm/managers/CodeGenerator.js.map +1 -1
- package/dist/esm/managers/ControlPanel.d.ts +124 -0
- package/dist/esm/managers/ControlPanel.d.ts.map +1 -0
- package/dist/esm/managers/ControlPanel.js +282 -0
- package/dist/esm/managers/ControlPanel.js.map +1 -0
- package/dist/esm/managers/DonobuFlow.d.ts +7 -14
- package/dist/esm/managers/DonobuFlow.d.ts.map +1 -1
- package/dist/esm/managers/DonobuFlow.js +124 -160
- package/dist/esm/managers/DonobuFlow.js.map +1 -1
- package/dist/esm/managers/DonobuFlowsManager.d.ts +47 -6
- package/dist/esm/managers/DonobuFlowsManager.d.ts.map +1 -1
- package/dist/esm/managers/DonobuFlowsManager.js +104 -24
- package/dist/esm/managers/DonobuFlowsManager.js.map +1 -1
- package/dist/esm/managers/DonobuStack.d.ts +18 -4
- package/dist/esm/managers/DonobuStack.d.ts.map +1 -1
- package/dist/esm/managers/DonobuStack.js +21 -5
- package/dist/esm/managers/DonobuStack.js.map +1 -1
- package/dist/esm/managers/EnvDataManager.d.ts +58 -0
- package/dist/esm/managers/EnvDataManager.d.ts.map +1 -0
- package/dist/esm/managers/EnvDataManager.js +134 -0
- package/dist/esm/managers/EnvDataManager.js.map +1 -0
- package/dist/esm/managers/EnvironmentDataManager.d.ts +58 -0
- package/dist/esm/managers/EnvironmentDataManager.d.ts.map +1 -0
- package/dist/esm/managers/EnvironmentDataManager.js +134 -0
- package/dist/esm/managers/EnvironmentDataManager.js.map +1 -0
- package/dist/esm/managers/GptConfigsManager.d.ts +1 -1
- package/dist/esm/managers/GptConfigsManager.d.ts.map +1 -1
- package/dist/esm/managers/InteractionVisualizer.d.ts +9 -15
- package/dist/esm/managers/InteractionVisualizer.d.ts.map +1 -1
- package/dist/esm/managers/InteractionVisualizer.js +44 -44
- package/dist/esm/managers/InteractionVisualizer.js.map +1 -1
- package/dist/esm/managers/PageInspector.d.ts +241 -0
- package/dist/esm/managers/PageInspector.d.ts.map +1 -0
- package/dist/esm/managers/PageInspector.js +786 -0
- package/dist/esm/managers/PageInspector.js.map +1 -0
- package/dist/esm/managers/ToolManager.d.ts +10 -0
- package/dist/esm/managers/ToolManager.d.ts.map +1 -1
- package/dist/esm/managers/ToolManager.js +49 -8
- package/dist/esm/managers/ToolManager.js.map +1 -1
- package/dist/esm/models/BrowserConfig.d.ts +1 -6
- package/dist/esm/models/BrowserConfig.d.ts.map +1 -1
- package/dist/esm/models/BrowserFramework.d.ts +2 -6
- package/dist/esm/models/BrowserFramework.d.ts.map +1 -1
- package/dist/esm/models/BrowserFramework.js +4 -22
- package/dist/esm/models/BrowserFramework.js.map +1 -1
- package/dist/esm/models/CreateDonobuFlow.d.ts +4 -0
- package/dist/esm/models/CreateDonobuFlow.d.ts.map +1 -1
- package/dist/esm/models/EnvironmentDatum.d.ts +54 -0
- package/dist/esm/models/EnvironmentDatum.d.ts.map +1 -0
- package/dist/esm/models/EnvironmentDatum.js +57 -0
- package/dist/esm/models/EnvironmentDatum.js.map +1 -0
- package/dist/esm/models/FlowMetadata.d.ts +14 -1
- package/dist/esm/models/FlowMetadata.d.ts.map +1 -1
- package/dist/esm/models/FlowMetadata.js.map +1 -1
- package/dist/esm/models/InteractableElement.d.ts +2 -2
- package/dist/esm/models/PaginatedResult.d.ts +10 -0
- package/dist/esm/models/PaginatedResult.d.ts.map +1 -0
- package/dist/esm/models/PaginatedResult.js +6 -0
- package/dist/esm/models/PaginatedResult.js.map +1 -0
- package/dist/esm/models/ToolCallContext.d.ts +8 -3
- package/dist/esm/models/ToolCallContext.d.ts.map +1 -1
- package/dist/esm/models/ToolTemplateDataSource.d.ts +4 -0
- package/dist/esm/models/ToolTemplateDataSource.d.ts.map +1 -1
- package/dist/esm/persistence/DonobuSqliteDb.d.ts.map +1 -1
- package/dist/esm/persistence/DonobuSqliteDb.js +12 -0
- package/dist/esm/persistence/DonobuSqliteDb.js.map +1 -1
- package/dist/esm/persistence/FlowsPersistence.d.ts +23 -14
- package/dist/esm/persistence/FlowsPersistence.d.ts.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceAwsS3.d.ts +10 -5
- package/dist/esm/persistence/FlowsPersistenceAwsS3.d.ts.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceAwsS3.js +79 -1
- package/dist/esm/persistence/FlowsPersistenceAwsS3.js.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceFactoryImpl.js +1 -1
- package/dist/esm/persistence/FlowsPersistenceFactoryImpl.js.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceFilesystem.d.ts +32 -5
- package/dist/esm/persistence/FlowsPersistenceFilesystem.d.ts.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceFilesystem.js +114 -4
- package/dist/esm/persistence/FlowsPersistenceFilesystem.js.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceGoogleCloudStorage.d.ts +10 -5
- package/dist/esm/persistence/FlowsPersistenceGoogleCloudStorage.d.ts.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceGoogleCloudStorage.js +58 -1
- package/dist/esm/persistence/FlowsPersistenceGoogleCloudStorage.js.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceSqlite.d.ts +12 -5
- package/dist/esm/persistence/FlowsPersistenceSqlite.d.ts.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceSqlite.js +35 -1
- package/dist/esm/persistence/FlowsPersistenceSqlite.js.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceSupabase.d.ts +10 -5
- package/dist/esm/persistence/FlowsPersistenceSupabase.d.ts.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceSupabase.js +46 -1
- package/dist/esm/persistence/FlowsPersistenceSupabase.js.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceVolatile.d.ts +10 -5
- package/dist/esm/persistence/FlowsPersistenceVolatile.d.ts.map +1 -1
- package/dist/esm/persistence/FlowsPersistenceVolatile.js +21 -1
- package/dist/esm/persistence/FlowsPersistenceVolatile.js.map +1 -1
- package/dist/esm/persistence/agents/AgentsPersistence.d.ts +12 -0
- package/dist/esm/persistence/agents/AgentsPersistence.d.ts.map +1 -0
- package/dist/esm/persistence/agents/AgentsPersistence.js +3 -0
- package/dist/esm/persistence/agents/AgentsPersistence.js.map +1 -0
- package/dist/esm/persistence/agents/AgentsPersistenceSqlite.d.ts +15 -0
- package/dist/esm/persistence/agents/AgentsPersistenceSqlite.d.ts.map +1 -0
- package/dist/esm/persistence/agents/AgentsPersistenceSqlite.js +50 -0
- package/dist/esm/persistence/agents/AgentsPersistenceSqlite.js.map +1 -0
- package/dist/esm/persistence/agents/AgentsPersistenceVolatile.d.ts +14 -0
- package/dist/esm/persistence/agents/AgentsPersistenceVolatile.d.ts.map +1 -0
- package/dist/esm/persistence/agents/AgentsPersistenceVolatile.js +26 -0
- package/dist/esm/persistence/agents/AgentsPersistenceVolatile.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistence.d.ts +20 -0
- package/dist/esm/persistence/env/EnvPersistence.d.ts.map +1 -0
- package/dist/esm/{models/ResolverContext.js → persistence/env/EnvPersistence.js} +1 -1
- package/dist/esm/persistence/env/EnvPersistence.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceAwsS3.d.ts +31 -0
- package/dist/esm/persistence/env/EnvPersistenceAwsS3.d.ts.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceAwsS3.js +117 -0
- package/dist/esm/persistence/env/EnvPersistenceAwsS3.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceFactory.d.ts +6 -0
- package/dist/esm/persistence/env/EnvPersistenceFactory.d.ts.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceFactory.js +3 -0
- package/dist/esm/persistence/env/EnvPersistenceFactory.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceFactoryImpl.d.ts +45 -0
- package/dist/esm/persistence/env/EnvPersistenceFactoryImpl.d.ts.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceFactoryImpl.js +86 -0
- package/dist/esm/persistence/env/EnvPersistenceFactoryImpl.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceFactoryPreset.d.ts +12 -0
- package/dist/esm/persistence/env/EnvPersistenceFactoryPreset.d.ts.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceFactoryPreset.js +17 -0
- package/dist/esm/persistence/env/EnvPersistenceFactoryPreset.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceFilesystem.d.ts +36 -0
- package/dist/esm/persistence/env/EnvPersistenceFilesystem.d.ts.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceFilesystem.js +132 -0
- package/dist/esm/persistence/env/EnvPersistenceFilesystem.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceGoogleCloudStorage.d.ts +30 -0
- package/dist/esm/persistence/env/EnvPersistenceGoogleCloudStorage.d.ts.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceGoogleCloudStorage.js +131 -0
- package/dist/esm/persistence/env/EnvPersistenceGoogleCloudStorage.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceSqlite.d.ts +19 -0
- package/dist/esm/persistence/env/EnvPersistenceSqlite.d.ts.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceSqlite.js +54 -0
- package/dist/esm/persistence/env/EnvPersistenceSqlite.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceSupabase.d.ts +17 -0
- package/dist/esm/persistence/env/EnvPersistenceSupabase.d.ts.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceSupabase.js +60 -0
- package/dist/esm/persistence/env/EnvPersistenceSupabase.js.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceVolatile.d.ts +13 -0
- package/dist/esm/persistence/env/EnvPersistenceVolatile.d.ts.map +1 -0
- package/dist/esm/persistence/env/EnvPersistenceVolatile.js +31 -0
- package/dist/esm/persistence/env/EnvPersistenceVolatile.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistence.d.ts +87 -0
- package/dist/esm/persistence/flows/FlowsPersistence.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistence.js +3 -0
- package/dist/esm/persistence/flows/FlowsPersistence.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceAwsS3.d.ts +71 -0
- package/dist/esm/persistence/flows/FlowsPersistenceAwsS3.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceAwsS3.js +448 -0
- package/dist/esm/persistence/flows/FlowsPersistenceAwsS3.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactory.d.ts +10 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactory.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactory.js +3 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactory.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactoryImpl.d.ts +57 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactoryImpl.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactoryImpl.js +238 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactoryImpl.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactoryPreset.d.ts +13 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactoryPreset.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactoryPreset.js +24 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFactoryPreset.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFilesystem.d.ts +52 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFilesystem.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFilesystem.js +291 -0
- package/dist/esm/persistence/flows/FlowsPersistenceFilesystem.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceGoogleCloudStorage.d.ts +71 -0
- package/dist/esm/persistence/flows/FlowsPersistenceGoogleCloudStorage.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceGoogleCloudStorage.js +429 -0
- package/dist/esm/persistence/flows/FlowsPersistenceGoogleCloudStorage.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceSqlite.d.ts +43 -0
- package/dist/esm/persistence/flows/FlowsPersistenceSqlite.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceSqlite.js +259 -0
- package/dist/esm/persistence/flows/FlowsPersistenceSqlite.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceSupabase.d.ts +40 -0
- package/dist/esm/persistence/flows/FlowsPersistenceSupabase.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceSupabase.js +218 -0
- package/dist/esm/persistence/flows/FlowsPersistenceSupabase.js.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceVolatile.d.ts +37 -0
- package/dist/esm/persistence/flows/FlowsPersistenceVolatile.d.ts.map +1 -0
- package/dist/esm/persistence/flows/FlowsPersistenceVolatile.js +151 -0
- package/dist/esm/persistence/flows/FlowsPersistenceVolatile.js.map +1 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistence.d.ts +12 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistence.d.ts.map +1 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistence.js +3 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistence.js.map +1 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistenceSqlite.d.ts +13 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistenceSqlite.d.ts.map +1 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistenceSqlite.js +35 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistenceSqlite.js.map +1 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistenceVolatile.d.ts +15 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistenceVolatile.d.ts.map +1 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistenceVolatile.js +31 -0
- package/dist/esm/persistence/gptconfigs/GptConfigsPersistenceVolatile.js.map +1 -0
- package/dist/esm/playwrightTestExtensions.d.ts +5 -0
- package/dist/esm/playwrightTestExtensions.d.ts.map +1 -1
- package/dist/esm/playwrightTestExtensions.js +83 -23
- package/dist/esm/playwrightTestExtensions.js.map +1 -1
- package/dist/esm/tools/AnalyzePageTextTool.js +1 -1
- package/dist/esm/tools/AnalyzePageTextTool.js.map +1 -1
- package/dist/esm/tools/AssertPageTextTool.js +1 -1
- package/dist/esm/tools/AssertPageTextTool.js.map +1 -1
- package/dist/esm/tools/AssertTool.d.ts.map +1 -1
- package/dist/esm/tools/AssertTool.js +4 -4
- package/dist/esm/tools/AssertTool.js.map +1 -1
- package/dist/esm/tools/ChangeWebBrowserTabTool.d.ts.map +1 -1
- package/dist/esm/tools/ChangeWebBrowserTabTool.js +8 -7
- package/dist/esm/tools/ChangeWebBrowserTabTool.js.map +1 -1
- package/dist/esm/tools/ClickTool.js +1 -1
- package/dist/esm/tools/ClickTool.js.map +1 -1
- package/dist/esm/tools/CreateBrowserCookieReportTool.js +1 -1
- package/dist/esm/tools/CreateBrowserCookieReportTool.js.map +1 -1
- package/dist/esm/tools/CustomToolRunnerTool.d.ts.map +1 -1
- package/dist/esm/tools/CustomToolRunnerTool.js +1 -1
- package/dist/esm/tools/CustomToolRunnerTool.js.map +1 -1
- package/dist/esm/tools/DetectBrokenLinksTool.js +1 -1
- package/dist/esm/tools/DetectBrokenLinksTool.js.map +1 -1
- package/dist/esm/tools/ExtractGoogleStreetviewEntityDataTool.js +1 -1
- package/dist/esm/tools/ExtractGoogleStreetviewEntityDataTool.js.map +1 -1
- package/dist/esm/tools/ExtractPaymentProviderKeyTool.js +1 -1
- package/dist/esm/tools/ExtractPaymentProviderKeyTool.js.map +1 -1
- package/dist/esm/tools/ExtractPublicFacebookEntityDataTool.js +1 -1
- package/dist/esm/tools/ExtractPublicFacebookEntityDataTool.js.map +1 -1
- package/dist/esm/tools/GoForwardOrBackTool.js +1 -1
- package/dist/esm/tools/GoForwardOrBackTool.js.map +1 -1
- package/dist/esm/tools/GoToGoogleMapsStreetViewTool.js +1 -1
- package/dist/esm/tools/GoToGoogleMapsStreetViewTool.js.map +1 -1
- package/dist/esm/tools/GoToWebpageTool.d.ts.map +1 -1
- package/dist/esm/tools/GoToWebpageTool.js +4 -3
- package/dist/esm/tools/GoToWebpageTool.js.map +1 -1
- package/dist/esm/tools/HoverOverElementTool.d.ts.map +1 -1
- package/dist/esm/tools/HoverOverElementTool.js +1 -1
- package/dist/esm/tools/HoverOverElementTool.js.map +1 -1
- package/dist/esm/tools/NavigateWithinStreetView.js +1 -1
- package/dist/esm/tools/NavigateWithinStreetView.js.map +1 -1
- package/dist/esm/tools/PressKeyTool.js +1 -1
- package/dist/esm/tools/PressKeyTool.js.map +1 -1
- package/dist/esm/tools/ReloadPageTool.js +1 -1
- package/dist/esm/tools/ReloadPageTool.js.map +1 -1
- package/dist/esm/tools/ReplayableInteraction.d.ts +16 -1
- package/dist/esm/tools/ReplayableInteraction.d.ts.map +1 -1
- package/dist/esm/tools/ReplayableInteraction.js +169 -16
- package/dist/esm/tools/ReplayableInteraction.js.map +1 -1
- package/dist/esm/tools/RunAccessibilityTestTool.d.ts +8 -0
- package/dist/esm/tools/RunAccessibilityTestTool.d.ts.map +1 -1
- package/dist/esm/tools/RunAccessibilityTestTool.js +15 -2
- package/dist/esm/tools/RunAccessibilityTestTool.js.map +1 -1
- package/dist/esm/tools/RunInlineJavaScriptCodeTool.d.ts.map +1 -1
- package/dist/esm/tools/RunInlineJavaScriptCodeTool.js +1 -1
- package/dist/esm/tools/RunInlineJavaScriptCodeTool.js.map +1 -1
- package/dist/esm/tools/SaveWebpageAsPdfTool.js +1 -1
- package/dist/esm/tools/SaveWebpageAsPdfTool.js.map +1 -1
- package/dist/esm/tools/ScrollPageTool.d.ts +1 -1
- package/dist/esm/tools/ScrollPageTool.d.ts.map +1 -1
- package/dist/esm/tools/ScrollPageTool.js +47 -4
- package/dist/esm/tools/ScrollPageTool.js.map +1 -1
- package/dist/esm/tools/WaitTool.js +1 -1
- package/dist/esm/tools/WaitTool.js.map +1 -1
- package/dist/esm/utils/MiscUtils.d.ts +2 -2
- package/dist/esm/utils/MiscUtils.js +2 -2
- package/dist/esm/utils/PlaywrightUtils.d.ts +26 -127
- package/dist/esm/utils/PlaywrightUtils.d.ts.map +1 -1
- package/dist/esm/utils/PlaywrightUtils.js +133 -935
- package/dist/esm/utils/PlaywrightUtils.js.map +1 -1
- package/dist/esm/utils/TemplateInterpolator.d.ts +21 -3
- package/dist/esm/utils/TemplateInterpolator.d.ts.map +1 -1
- package/dist/esm/utils/TemplateInterpolator.js +167 -21
- package/dist/esm/utils/TemplateInterpolator.js.map +1 -1
- package/dist/lib/DonobuExtendedPage.d.ts +106 -0
- package/dist/lib/DonobuExtendedPage.d.ts.map +1 -0
- package/dist/lib/DonobuExtendedPage.js +3 -0
- package/dist/lib/DonobuExtendedPage.js.map +1 -0
- package/dist/lib/constants.d.ts +8 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +14 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/fixtures/browserState.d.ts +6 -0
- package/dist/lib/fixtures/browserState.d.ts.map +1 -0
- package/dist/lib/fixtures/browserState.js +15 -0
- package/dist/lib/fixtures/browserState.js.map +1 -0
- package/dist/lib/fixtures/gptClients.d.ts +40 -0
- package/dist/lib/fixtures/gptClients.d.ts.map +1 -0
- package/dist/lib/fixtures/gptClients.js +187 -0
- package/dist/lib/fixtures/gptClients.js.map +1 -0
- package/dist/lib/fixtures/testExtension.d.ts +10 -0
- package/dist/lib/fixtures/testExtension.d.ts.map +1 -0
- package/dist/lib/fixtures/testExtension.js +383 -0
- package/dist/lib/fixtures/testExtension.js.map +1 -0
- package/dist/lib/testExtension.d.ts +10 -0
- package/dist/lib/testExtension.d.ts.map +1 -0
- package/dist/lib/testExtension.js +383 -0
- package/dist/lib/testExtension.js.map +1 -0
- package/dist/lib/types.d.ts +106 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/{models/BrowserState.js → lib/types.js} +1 -1
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils/donobuTestStack.d.ts +7 -0
- package/dist/lib/utils/donobuTestStack.d.ts.map +1 -0
- package/dist/lib/utils/donobuTestStack.js +31 -0
- package/dist/lib/utils/donobuTestStack.js.map +1 -0
- package/dist/lib/utils/selfHealing.d.ts +15 -0
- package/dist/lib/utils/selfHealing.d.ts.map +1 -0
- package/dist/lib/utils/selfHealing.js +89 -0
- package/dist/lib/utils/selfHealing.js.map +1 -0
- package/dist/main.d.ts +5 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +8 -5
- package/dist/main.js.map +1 -1
- package/dist/managers/AdminApiController.d.ts.map +1 -1
- package/dist/managers/AdminApiController.js +7 -0
- package/dist/managers/AdminApiController.js.map +1 -1
- package/dist/managers/AgentsManager.d.ts +1 -1
- package/dist/managers/AgentsManager.d.ts.map +1 -1
- package/dist/managers/CodeGenerator.d.ts.map +1 -1
- package/dist/managers/CodeGenerator.js +2 -1
- package/dist/managers/CodeGenerator.js.map +1 -1
- package/dist/managers/ControlPanel.d.ts +124 -0
- package/dist/managers/ControlPanel.d.ts.map +1 -0
- package/dist/managers/ControlPanel.js +282 -0
- package/dist/managers/ControlPanel.js.map +1 -0
- package/dist/managers/DonobuFlow.d.ts +7 -14
- package/dist/managers/DonobuFlow.d.ts.map +1 -1
- package/dist/managers/DonobuFlow.js +124 -160
- package/dist/managers/DonobuFlow.js.map +1 -1
- package/dist/managers/DonobuFlowsManager.d.ts +47 -6
- package/dist/managers/DonobuFlowsManager.d.ts.map +1 -1
- package/dist/managers/DonobuFlowsManager.js +104 -24
- package/dist/managers/DonobuFlowsManager.js.map +1 -1
- package/dist/managers/DonobuStack.d.ts +18 -4
- package/dist/managers/DonobuStack.d.ts.map +1 -1
- package/dist/managers/DonobuStack.js +21 -5
- package/dist/managers/DonobuStack.js.map +1 -1
- package/dist/managers/EnvDataManager.d.ts +58 -0
- package/dist/managers/EnvDataManager.d.ts.map +1 -0
- package/dist/managers/EnvDataManager.js +134 -0
- package/dist/managers/EnvDataManager.js.map +1 -0
- package/dist/managers/EnvironmentDataManager.d.ts +58 -0
- package/dist/managers/EnvironmentDataManager.d.ts.map +1 -0
- package/dist/managers/EnvironmentDataManager.js +134 -0
- package/dist/managers/EnvironmentDataManager.js.map +1 -0
- package/dist/managers/GptConfigsManager.d.ts +1 -1
- package/dist/managers/GptConfigsManager.d.ts.map +1 -1
- package/dist/managers/InteractionVisualizer.d.ts +9 -15
- package/dist/managers/InteractionVisualizer.d.ts.map +1 -1
- package/dist/managers/InteractionVisualizer.js +44 -44
- package/dist/managers/InteractionVisualizer.js.map +1 -1
- package/dist/managers/PageInspector.d.ts +241 -0
- package/dist/managers/PageInspector.d.ts.map +1 -0
- package/dist/managers/PageInspector.js +786 -0
- package/dist/managers/PageInspector.js.map +1 -0
- package/dist/managers/ToolManager.d.ts +10 -0
- package/dist/managers/ToolManager.d.ts.map +1 -1
- package/dist/managers/ToolManager.js +49 -8
- package/dist/managers/ToolManager.js.map +1 -1
- package/dist/models/BrowserConfig.d.ts +1 -6
- package/dist/models/BrowserConfig.d.ts.map +1 -1
- package/dist/models/BrowserFramework.d.ts +2 -6
- package/dist/models/BrowserFramework.d.ts.map +1 -1
- package/dist/models/BrowserFramework.js +4 -22
- package/dist/models/BrowserFramework.js.map +1 -1
- package/dist/models/CreateDonobuFlow.d.ts +4 -0
- package/dist/models/CreateDonobuFlow.d.ts.map +1 -1
- package/dist/models/EnvironmentDatum.d.ts +54 -0
- package/dist/models/EnvironmentDatum.d.ts.map +1 -0
- package/dist/models/EnvironmentDatum.js +57 -0
- package/dist/models/EnvironmentDatum.js.map +1 -0
- package/dist/models/FlowMetadata.d.ts +14 -1
- package/dist/models/FlowMetadata.d.ts.map +1 -1
- package/dist/models/FlowMetadata.js.map +1 -1
- package/dist/models/InteractableElement.d.ts +2 -2
- package/dist/models/PaginatedResult.d.ts +10 -0
- package/dist/models/PaginatedResult.d.ts.map +1 -0
- package/dist/models/PaginatedResult.js +6 -0
- package/dist/models/PaginatedResult.js.map +1 -0
- package/dist/models/ToolCallContext.d.ts +8 -3
- package/dist/models/ToolCallContext.d.ts.map +1 -1
- package/dist/models/ToolTemplateDataSource.d.ts +4 -0
- package/dist/models/ToolTemplateDataSource.d.ts.map +1 -1
- package/dist/persistence/DonobuSqliteDb.d.ts.map +1 -1
- package/dist/persistence/DonobuSqliteDb.js +12 -0
- package/dist/persistence/DonobuSqliteDb.js.map +1 -1
- package/dist/persistence/FlowsPersistence.d.ts +23 -14
- package/dist/persistence/FlowsPersistence.d.ts.map +1 -1
- package/dist/persistence/FlowsPersistenceAwsS3.d.ts +10 -5
- package/dist/persistence/FlowsPersistenceAwsS3.d.ts.map +1 -1
- package/dist/persistence/FlowsPersistenceAwsS3.js +79 -1
- package/dist/persistence/FlowsPersistenceAwsS3.js.map +1 -1
- package/dist/persistence/FlowsPersistenceFactoryImpl.js +1 -1
- package/dist/persistence/FlowsPersistenceFactoryImpl.js.map +1 -1
- package/dist/persistence/FlowsPersistenceFilesystem.d.ts +32 -5
- package/dist/persistence/FlowsPersistenceFilesystem.d.ts.map +1 -1
- package/dist/persistence/FlowsPersistenceFilesystem.js +114 -4
- package/dist/persistence/FlowsPersistenceFilesystem.js.map +1 -1
- package/dist/persistence/FlowsPersistenceGoogleCloudStorage.d.ts +10 -5
- package/dist/persistence/FlowsPersistenceGoogleCloudStorage.d.ts.map +1 -1
- package/dist/persistence/FlowsPersistenceGoogleCloudStorage.js +58 -1
- package/dist/persistence/FlowsPersistenceGoogleCloudStorage.js.map +1 -1
- package/dist/persistence/FlowsPersistenceSqlite.d.ts +12 -5
- package/dist/persistence/FlowsPersistenceSqlite.d.ts.map +1 -1
- package/dist/persistence/FlowsPersistenceSqlite.js +35 -1
- package/dist/persistence/FlowsPersistenceSqlite.js.map +1 -1
- package/dist/persistence/FlowsPersistenceSupabase.d.ts +10 -5
- package/dist/persistence/FlowsPersistenceSupabase.d.ts.map +1 -1
- package/dist/persistence/FlowsPersistenceSupabase.js +46 -1
- package/dist/persistence/FlowsPersistenceSupabase.js.map +1 -1
- package/dist/persistence/FlowsPersistenceVolatile.d.ts +10 -5
- package/dist/persistence/FlowsPersistenceVolatile.d.ts.map +1 -1
- package/dist/persistence/FlowsPersistenceVolatile.js +21 -1
- package/dist/persistence/FlowsPersistenceVolatile.js.map +1 -1
- package/dist/persistence/agents/AgentsPersistence.d.ts +12 -0
- package/dist/persistence/agents/AgentsPersistence.d.ts.map +1 -0
- package/dist/persistence/agents/AgentsPersistence.js +3 -0
- package/dist/persistence/agents/AgentsPersistence.js.map +1 -0
- package/dist/persistence/agents/AgentsPersistenceSqlite.d.ts +15 -0
- package/dist/persistence/agents/AgentsPersistenceSqlite.d.ts.map +1 -0
- package/dist/persistence/agents/AgentsPersistenceSqlite.js +50 -0
- package/dist/persistence/agents/AgentsPersistenceSqlite.js.map +1 -0
- package/dist/persistence/agents/AgentsPersistenceVolatile.d.ts +14 -0
- package/dist/persistence/agents/AgentsPersistenceVolatile.d.ts.map +1 -0
- package/dist/persistence/agents/AgentsPersistenceVolatile.js +26 -0
- package/dist/persistence/agents/AgentsPersistenceVolatile.js.map +1 -0
- package/dist/persistence/env/EnvPersistence.d.ts +20 -0
- package/dist/persistence/env/EnvPersistence.d.ts.map +1 -0
- package/dist/{models/ResolverContext.js → persistence/env/EnvPersistence.js} +1 -1
- package/dist/persistence/env/EnvPersistence.js.map +1 -0
- package/dist/persistence/env/EnvPersistenceAwsS3.d.ts +31 -0
- package/dist/persistence/env/EnvPersistenceAwsS3.d.ts.map +1 -0
- package/dist/persistence/env/EnvPersistenceAwsS3.js +117 -0
- package/dist/persistence/env/EnvPersistenceAwsS3.js.map +1 -0
- package/dist/persistence/env/EnvPersistenceFactory.d.ts +6 -0
- package/dist/persistence/env/EnvPersistenceFactory.d.ts.map +1 -0
- package/dist/persistence/env/EnvPersistenceFactory.js +3 -0
- package/dist/persistence/env/EnvPersistenceFactory.js.map +1 -0
- package/dist/persistence/env/EnvPersistenceFactoryImpl.d.ts +45 -0
- package/dist/persistence/env/EnvPersistenceFactoryImpl.d.ts.map +1 -0
- package/dist/persistence/env/EnvPersistenceFactoryImpl.js +86 -0
- package/dist/persistence/env/EnvPersistenceFactoryImpl.js.map +1 -0
- package/dist/persistence/env/EnvPersistenceFactoryPreset.d.ts +12 -0
- package/dist/persistence/env/EnvPersistenceFactoryPreset.d.ts.map +1 -0
- package/dist/persistence/env/EnvPersistenceFactoryPreset.js +17 -0
- package/dist/persistence/env/EnvPersistenceFactoryPreset.js.map +1 -0
- package/dist/persistence/env/EnvPersistenceFilesystem.d.ts +36 -0
- package/dist/persistence/env/EnvPersistenceFilesystem.d.ts.map +1 -0
- package/dist/persistence/env/EnvPersistenceFilesystem.js +132 -0
- package/dist/persistence/env/EnvPersistenceFilesystem.js.map +1 -0
- package/dist/persistence/env/EnvPersistenceGoogleCloudStorage.d.ts +30 -0
- package/dist/persistence/env/EnvPersistenceGoogleCloudStorage.d.ts.map +1 -0
- package/dist/persistence/env/EnvPersistenceGoogleCloudStorage.js +131 -0
- package/dist/persistence/env/EnvPersistenceGoogleCloudStorage.js.map +1 -0
- package/dist/persistence/env/EnvPersistenceSqlite.d.ts +19 -0
- package/dist/persistence/env/EnvPersistenceSqlite.d.ts.map +1 -0
- package/dist/persistence/env/EnvPersistenceSqlite.js +54 -0
- package/dist/persistence/env/EnvPersistenceSqlite.js.map +1 -0
- package/dist/persistence/env/EnvPersistenceSupabase.d.ts +17 -0
- package/dist/persistence/env/EnvPersistenceSupabase.d.ts.map +1 -0
- package/dist/persistence/env/EnvPersistenceSupabase.js +60 -0
- package/dist/persistence/env/EnvPersistenceSupabase.js.map +1 -0
- package/dist/persistence/env/EnvPersistenceVolatile.d.ts +13 -0
- package/dist/persistence/env/EnvPersistenceVolatile.d.ts.map +1 -0
- package/dist/persistence/env/EnvPersistenceVolatile.js +31 -0
- package/dist/persistence/env/EnvPersistenceVolatile.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistence.d.ts +87 -0
- package/dist/persistence/flows/FlowsPersistence.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistence.js +3 -0
- package/dist/persistence/flows/FlowsPersistence.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceAwsS3.d.ts +71 -0
- package/dist/persistence/flows/FlowsPersistenceAwsS3.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceAwsS3.js +448 -0
- package/dist/persistence/flows/FlowsPersistenceAwsS3.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceFactory.d.ts +10 -0
- package/dist/persistence/flows/FlowsPersistenceFactory.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceFactory.js +3 -0
- package/dist/persistence/flows/FlowsPersistenceFactory.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceFactoryImpl.d.ts +57 -0
- package/dist/persistence/flows/FlowsPersistenceFactoryImpl.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceFactoryImpl.js +238 -0
- package/dist/persistence/flows/FlowsPersistenceFactoryImpl.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceFactoryPreset.d.ts +13 -0
- package/dist/persistence/flows/FlowsPersistenceFactoryPreset.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceFactoryPreset.js +24 -0
- package/dist/persistence/flows/FlowsPersistenceFactoryPreset.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceFilesystem.d.ts +52 -0
- package/dist/persistence/flows/FlowsPersistenceFilesystem.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceFilesystem.js +291 -0
- package/dist/persistence/flows/FlowsPersistenceFilesystem.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceGoogleCloudStorage.d.ts +71 -0
- package/dist/persistence/flows/FlowsPersistenceGoogleCloudStorage.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceGoogleCloudStorage.js +429 -0
- package/dist/persistence/flows/FlowsPersistenceGoogleCloudStorage.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceSqlite.d.ts +43 -0
- package/dist/persistence/flows/FlowsPersistenceSqlite.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceSqlite.js +259 -0
- package/dist/persistence/flows/FlowsPersistenceSqlite.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceSupabase.d.ts +40 -0
- package/dist/persistence/flows/FlowsPersistenceSupabase.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceSupabase.js +218 -0
- package/dist/persistence/flows/FlowsPersistenceSupabase.js.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceVolatile.d.ts +37 -0
- package/dist/persistence/flows/FlowsPersistenceVolatile.d.ts.map +1 -0
- package/dist/persistence/flows/FlowsPersistenceVolatile.js +151 -0
- package/dist/persistence/flows/FlowsPersistenceVolatile.js.map +1 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistence.d.ts +12 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistence.d.ts.map +1 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistence.js +3 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistence.js.map +1 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistenceSqlite.d.ts +13 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistenceSqlite.d.ts.map +1 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistenceSqlite.js +35 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistenceSqlite.js.map +1 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistenceVolatile.d.ts +15 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistenceVolatile.d.ts.map +1 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistenceVolatile.js +31 -0
- package/dist/persistence/gptconfigs/GptConfigsPersistenceVolatile.js.map +1 -0
- package/dist/playwrightTestExtensions.d.ts +5 -0
- package/dist/playwrightTestExtensions.d.ts.map +1 -1
- package/dist/playwrightTestExtensions.js +83 -23
- package/dist/playwrightTestExtensions.js.map +1 -1
- package/dist/tools/AnalyzePageTextTool.js +1 -1
- package/dist/tools/AnalyzePageTextTool.js.map +1 -1
- package/dist/tools/AssertPageTextTool.js +1 -1
- package/dist/tools/AssertPageTextTool.js.map +1 -1
- package/dist/tools/AssertTool.d.ts.map +1 -1
- package/dist/tools/AssertTool.js +4 -4
- package/dist/tools/AssertTool.js.map +1 -1
- package/dist/tools/ChangeWebBrowserTabTool.d.ts.map +1 -1
- package/dist/tools/ChangeWebBrowserTabTool.js +8 -7
- package/dist/tools/ChangeWebBrowserTabTool.js.map +1 -1
- package/dist/tools/ClickTool.js +1 -1
- package/dist/tools/ClickTool.js.map +1 -1
- package/dist/tools/CreateBrowserCookieReportTool.js +1 -1
- package/dist/tools/CreateBrowserCookieReportTool.js.map +1 -1
- package/dist/tools/CustomToolRunnerTool.d.ts.map +1 -1
- package/dist/tools/CustomToolRunnerTool.js +1 -1
- package/dist/tools/CustomToolRunnerTool.js.map +1 -1
- package/dist/tools/DetectBrokenLinksTool.js +1 -1
- package/dist/tools/DetectBrokenLinksTool.js.map +1 -1
- package/dist/tools/ExtractGoogleStreetviewEntityDataTool.js +1 -1
- package/dist/tools/ExtractGoogleStreetviewEntityDataTool.js.map +1 -1
- package/dist/tools/ExtractPaymentProviderKeyTool.js +1 -1
- package/dist/tools/ExtractPaymentProviderKeyTool.js.map +1 -1
- package/dist/tools/ExtractPublicFacebookEntityDataTool.js +1 -1
- package/dist/tools/ExtractPublicFacebookEntityDataTool.js.map +1 -1
- package/dist/tools/GoForwardOrBackTool.js +1 -1
- package/dist/tools/GoForwardOrBackTool.js.map +1 -1
- package/dist/tools/GoToGoogleMapsStreetViewTool.js +1 -1
- package/dist/tools/GoToGoogleMapsStreetViewTool.js.map +1 -1
- package/dist/tools/GoToWebpageTool.d.ts.map +1 -1
- package/dist/tools/GoToWebpageTool.js +4 -3
- package/dist/tools/GoToWebpageTool.js.map +1 -1
- package/dist/tools/HoverOverElementTool.d.ts.map +1 -1
- package/dist/tools/HoverOverElementTool.js +1 -1
- package/dist/tools/HoverOverElementTool.js.map +1 -1
- package/dist/tools/NavigateWithinStreetView.js +1 -1
- package/dist/tools/NavigateWithinStreetView.js.map +1 -1
- package/dist/tools/PressKeyTool.js +1 -1
- package/dist/tools/PressKeyTool.js.map +1 -1
- package/dist/tools/ReloadPageTool.js +1 -1
- package/dist/tools/ReloadPageTool.js.map +1 -1
- package/dist/tools/ReplayableInteraction.d.ts +16 -1
- package/dist/tools/ReplayableInteraction.d.ts.map +1 -1
- package/dist/tools/ReplayableInteraction.js +169 -16
- package/dist/tools/ReplayableInteraction.js.map +1 -1
- package/dist/tools/RunAccessibilityTestTool.d.ts +8 -0
- package/dist/tools/RunAccessibilityTestTool.d.ts.map +1 -1
- package/dist/tools/RunAccessibilityTestTool.js +15 -2
- package/dist/tools/RunAccessibilityTestTool.js.map +1 -1
- package/dist/tools/RunInlineJavaScriptCodeTool.d.ts.map +1 -1
- package/dist/tools/RunInlineJavaScriptCodeTool.js +1 -1
- package/dist/tools/RunInlineJavaScriptCodeTool.js.map +1 -1
- package/dist/tools/SaveWebpageAsPdfTool.js +1 -1
- package/dist/tools/SaveWebpageAsPdfTool.js.map +1 -1
- package/dist/tools/ScrollPageTool.d.ts +1 -1
- package/dist/tools/ScrollPageTool.d.ts.map +1 -1
- package/dist/tools/ScrollPageTool.js +47 -4
- package/dist/tools/ScrollPageTool.js.map +1 -1
- package/dist/tools/WaitTool.js +1 -1
- package/dist/tools/WaitTool.js.map +1 -1
- package/dist/utils/MiscUtils.d.ts +2 -2
- package/dist/utils/MiscUtils.js +2 -2
- package/dist/utils/PlaywrightUtils.d.ts +26 -127
- package/dist/utils/PlaywrightUtils.d.ts.map +1 -1
- package/dist/utils/PlaywrightUtils.js +133 -935
- package/dist/utils/PlaywrightUtils.js.map +1 -1
- package/dist/utils/TemplateInterpolator.d.ts +21 -3
- package/dist/utils/TemplateInterpolator.d.ts.map +1 -1
- package/dist/utils/TemplateInterpolator.js +162 -21
- package/dist/utils/TemplateInterpolator.js.map +1 -1
- package/package.json +3 -1
- package/dist/assets/clickable-elements-tracker.js +0 -63
- package/dist/assets/zaru-eyes.html +0 -141
- package/dist/esm/assets/clickable-elements-tracker.js +0 -63
- package/dist/esm/assets/zaru-eyes.html +0 -141
- package/dist/esm/managers/TemplateInterpolator.d.ts +0 -19
- package/dist/esm/managers/TemplateInterpolator.d.ts.map +0 -1
- package/dist/esm/managers/TemplateInterpolator.js +0 -86
- package/dist/esm/managers/TemplateInterpolator.js.map +0 -1
- package/dist/esm/managers/ToolTipper.d.ts +0 -32
- package/dist/esm/managers/ToolTipper.d.ts.map +0 -1
- package/dist/esm/managers/ToolTipper.js +0 -229
- package/dist/esm/managers/ToolTipper.js.map +0 -1
- package/dist/esm/models/BrowserState.d.ts +0 -26
- package/dist/esm/models/BrowserState.d.ts.map +0 -1
- package/dist/esm/models/BrowserState.js.map +0 -1
- package/dist/esm/models/ResolverContext.d.ts +0 -7
- package/dist/esm/models/ResolverContext.d.ts.map +0 -1
- package/dist/esm/models/ResolverContext.js.map +0 -1
- package/dist/esm/test.d.ts +0 -78
- package/dist/esm/test.d.ts.map +0 -1
- package/dist/esm/test.js +0 -423
- package/dist/esm/test.js.map +0 -1
- package/dist/managers/TemplateInterpolator.d.ts +0 -19
- package/dist/managers/TemplateInterpolator.d.ts.map +0 -1
- package/dist/managers/TemplateInterpolator.js +0 -86
- package/dist/managers/TemplateInterpolator.js.map +0 -1
- package/dist/managers/ToolTipper.d.ts +0 -32
- package/dist/managers/ToolTipper.d.ts.map +0 -1
- package/dist/managers/ToolTipper.js +0 -229
- package/dist/managers/ToolTipper.js.map +0 -1
- package/dist/models/BrowserState.d.ts +0 -26
- package/dist/models/BrowserState.d.ts.map +0 -1
- package/dist/models/BrowserState.js.map +0 -1
- package/dist/models/ResolverContext.d.ts +0 -7
- package/dist/models/ResolverContext.d.ts.map +0 -1
- package/dist/models/ResolverContext.js.map +0 -1
- package/dist/test.d.ts +0 -78
- package/dist/test.d.ts.map +0 -1
- package/dist/test.js +0 -423
- package/dist/test.js.map +0 -1
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
|
@@ -0,0 +1,786 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PageInspector = void 0;
|
|
7
|
+
const PageClosedException_1 = require("../exceptions/PageClosedException");
|
|
8
|
+
const PlaywrightUtils_1 = require("../utils/PlaywrightUtils");
|
|
9
|
+
const MiscUtils_1 = require("../utils/MiscUtils");
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
/**
|
|
12
|
+
* A class for identifying, attributing, and annotating interactable elements on web pages.
|
|
13
|
+
*
|
|
14
|
+
* The PageInspector provides functionality to:
|
|
15
|
+
* - Find and attribute interactable elements with unique identifiers
|
|
16
|
+
* - Retrieve information about attributed elements
|
|
17
|
+
* - Add visual annotations (numbered indicators) to interactable elements
|
|
18
|
+
* - Clean up both attributes and annotations
|
|
19
|
+
*
|
|
20
|
+
* Interactable elements are determined using comprehensive heuristics including:
|
|
21
|
+
* - Standard HTML interactive elements (buttons, inputs, links, etc.)
|
|
22
|
+
* - Elements with ARIA roles indicating interactivity
|
|
23
|
+
* - Elements with event handlers or CSS classes suggesting interactivity
|
|
24
|
+
* - Elements that are visible, enabled, and accessible at their coordinates
|
|
25
|
+
*
|
|
26
|
+
* This class is designed to work with Playwright's Page and Frame objects
|
|
27
|
+
* and handles cross-frame navigation, shadow DOM, and various edge cases.
|
|
28
|
+
*
|
|
29
|
+
* WARNING: It is REQUIRED that the {@link PageInspector.INIT_SCRIPT} has been
|
|
30
|
+
* run in the browser context before calling this class's methods.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Basic usage
|
|
35
|
+
* await browserContext.addInitScript(PageInspector.INIT_SCRIPT);
|
|
36
|
+
* const inspector = new PageInspector();
|
|
37
|
+
*
|
|
38
|
+
* const page = await browserContext.newPage();
|
|
39
|
+
* await page.goto("https://google.com");
|
|
40
|
+
*
|
|
41
|
+
* // Find and attribute interactable elements
|
|
42
|
+
* await inspector.attributeInteractableElements(page);
|
|
43
|
+
*
|
|
44
|
+
* // Get information about interactable elements
|
|
45
|
+
* const elements = await inspector.getAttributedInteractableElements(page);
|
|
46
|
+
*
|
|
47
|
+
* // Add visual annotations to the page
|
|
48
|
+
* await inspector.annotateInteractableElements(page);
|
|
49
|
+
*
|
|
50
|
+
* // Clean up when done
|
|
51
|
+
* await inspector.removeDonobuAnnotations(page);
|
|
52
|
+
* await inspector.deattributeVisibleInteractableElements(page);
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* This class uses custom HTML attributes (`data-donobu-interactable` by default)
|
|
57
|
+
* to mark elements, and creates a shadow DOM container for annotations to avoid
|
|
58
|
+
* style conflicts with the target page.
|
|
59
|
+
*
|
|
60
|
+
* All methods will throw a {@link PageClosedException} if the page is closed
|
|
61
|
+
* during operation.
|
|
62
|
+
*/
|
|
63
|
+
class PageInspector {
|
|
64
|
+
constructor(interactableElementAttribute = 'data-donobu-interactable', interactableAnnotationAttribute = 'data-donobu-annotation') {
|
|
65
|
+
this.interactableElementAttribute = interactableElementAttribute;
|
|
66
|
+
this.interactableAnnotationAttribute = interactableAnnotationAttribute;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Assigns a globally unique attribute to all visible and interactable elements in the page.
|
|
70
|
+
*
|
|
71
|
+
* This method performs the following steps:
|
|
72
|
+
* 1. Removes any pre-existing interactable element attributes from the page
|
|
73
|
+
* 2. Assigns sequential numeric values as attributes to interactable elements in the main frame
|
|
74
|
+
* 3. Processes child frames that are visible in the viewport and assigns attributes to their interactable elements
|
|
75
|
+
*
|
|
76
|
+
* The method identifies "interactable" elements based on tag names, ARIA roles, CSS classes, and other heuristics.
|
|
77
|
+
* Only elements that are:
|
|
78
|
+
* - Visible (non-zero dimensions and not hidden via CSS)
|
|
79
|
+
* - More than 50% in the viewport
|
|
80
|
+
* - Not disabled or inert
|
|
81
|
+
* - Actually reachable at their coordinates (topmost in z-index)
|
|
82
|
+
* will receive the attribute.
|
|
83
|
+
*
|
|
84
|
+
* @param page - The Playwright Page object to process
|
|
85
|
+
* @throws {PageClosedException} If the page is closed during processing
|
|
86
|
+
* @returns {Promise<void>} A promise that resolves when all elements have been attributed
|
|
87
|
+
*/
|
|
88
|
+
async attributeInteractableElements(page) {
|
|
89
|
+
try {
|
|
90
|
+
// Remove any preexisting attributes
|
|
91
|
+
await this.deattributeInteractableElements(page);
|
|
92
|
+
// Get viewport dimensions and scroll position properly
|
|
93
|
+
const viewportInfo = await page.evaluate(() => {
|
|
94
|
+
return {
|
|
95
|
+
viewportWidth: window.innerWidth,
|
|
96
|
+
viewportHeight: window.innerHeight,
|
|
97
|
+
scrollX: window.scrollX || window.pageXOffset,
|
|
98
|
+
scrollY: window.scrollY || window.pageYOffset,
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
// 1) Attribute elements in the main page
|
|
102
|
+
let annotationOffset = await page.evaluate(PageInspector.attributeElementsInContext, [0, this.interactableElementAttribute]);
|
|
103
|
+
// 2) Check child frames, attributing elements if the frame is (partially) in view
|
|
104
|
+
const frames = page
|
|
105
|
+
.frames()
|
|
106
|
+
.filter((frame) => PageInspector.frameFilter(frame) && frame !== page.mainFrame());
|
|
107
|
+
for (const frame of frames) {
|
|
108
|
+
const elementHandle = await frame.frameElement();
|
|
109
|
+
if (!elementHandle) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const boundingBox = await elementHandle.boundingBox();
|
|
113
|
+
if (!boundingBox) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
// boundingBox coordinates are already in viewport space, so we need to account for scroll
|
|
117
|
+
const isInViewport = boundingBox.x + boundingBox.width > 0 &&
|
|
118
|
+
boundingBox.x < viewportInfo.viewportWidth &&
|
|
119
|
+
boundingBox.y + boundingBox.height > 0 &&
|
|
120
|
+
boundingBox.y < viewportInfo.viewportHeight;
|
|
121
|
+
if (isInViewport) {
|
|
122
|
+
annotationOffset = await frame.evaluate(PageInspector.attributeElementsInContext, [annotationOffset, this.interactableElementAttribute]);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
if (PlaywrightUtils_1.PlaywrightUtils.isPageClosedError(error)) {
|
|
128
|
+
throw new PageClosedException_1.PageClosedException();
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Retrieves all elements that have been previously attributed with the interactable element attribute.
|
|
137
|
+
*
|
|
138
|
+
* This method:
|
|
139
|
+
* 1. Searches all frames in the page (including the main frame and child frames)
|
|
140
|
+
* 2. Collects elements with the {@link interactableElementAttribute} attribute
|
|
141
|
+
* 3. Creates an {@link InteractableElement} object for each attributed element
|
|
142
|
+
*
|
|
143
|
+
* For each interactable element, it extracts:
|
|
144
|
+
* - The attribute value (serving as a unique identifier)
|
|
145
|
+
* - A simplified HTML snippet representation of the element
|
|
146
|
+
* * For 'select' elements, the complete HTML (including options) is preserved
|
|
147
|
+
* * For all other elements, only the opening tag without children is captured
|
|
148
|
+
*
|
|
149
|
+
* Note: This method only finds elements that have been previously attributed using
|
|
150
|
+
* the {@link attributeInteractableElements} method.
|
|
151
|
+
*
|
|
152
|
+
* @param page - The Playwright Page object to process
|
|
153
|
+
* @returns {Promise<InteractableElement[]>} A promise that resolves to an array of
|
|
154
|
+
* interactable elements with their attribute values and HTML snippets
|
|
155
|
+
* @throws {PageClosedException} If the page is closed during processing
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* const inspector = new PageInspector();
|
|
159
|
+
* await inspector.attributeInteractableElements(page);
|
|
160
|
+
* const elements = await inspector.getAttributedInteractableElements(page);
|
|
161
|
+
* // elements = [{ donobuAttributeValue: "0", htmlSnippet: "<button id=\"submit\">"}]
|
|
162
|
+
*/
|
|
163
|
+
async getAttributedInteractableElements(page) {
|
|
164
|
+
try {
|
|
165
|
+
const interactableElements = [];
|
|
166
|
+
const frames = page
|
|
167
|
+
.frames()
|
|
168
|
+
.filter((frame) => PageInspector.frameFilter(frame));
|
|
169
|
+
for (const frame of frames) {
|
|
170
|
+
const attributeMap = await frame.evaluate((interactableAttribute) => {
|
|
171
|
+
const getOuterHTMLWithoutChildrenExceptForSelectElements = (element) => {
|
|
172
|
+
if (element.tagName.toLowerCase() === 'select') {
|
|
173
|
+
return element.outerHTML;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
const tempElement = document.createElement('div');
|
|
177
|
+
tempElement.appendChild(element.cloneNode(false));
|
|
178
|
+
return tempElement.innerHTML;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const attributeToHtmlMap = {};
|
|
182
|
+
const elements = document.querySelectorAll(`[${interactableAttribute}]`);
|
|
183
|
+
elements.forEach((element) => {
|
|
184
|
+
const attributeValue = element.getAttribute(interactableAttribute);
|
|
185
|
+
const outerHtml = getOuterHTMLWithoutChildrenExceptForSelectElements(element);
|
|
186
|
+
if (attributeValue) {
|
|
187
|
+
attributeToHtmlMap[attributeValue] = outerHtml;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
return attributeToHtmlMap;
|
|
191
|
+
}, this.interactableElementAttribute);
|
|
192
|
+
Object.entries(attributeMap).forEach(([donobuAttributeValue, htmlSnippet]) => {
|
|
193
|
+
interactableElements.push({
|
|
194
|
+
donobuAttributeValue,
|
|
195
|
+
htmlSnippet,
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return interactableElements;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
if (PlaywrightUtils_1.PlaywrightUtils.isPageClosedError(error)) {
|
|
203
|
+
throw new PageClosedException_1.PageClosedException();
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Visually annotates all interactable elements with numbered indicators on the page.
|
|
212
|
+
*
|
|
213
|
+
* This method:
|
|
214
|
+
* 1. Processes all accessible frames in the page
|
|
215
|
+
* 2. Creates (or reuses) a shadow DOM container to isolate annotation styling
|
|
216
|
+
* 3. Places circular numbered indicators over each element that has the
|
|
217
|
+
* {@link interactableElementAttribute} attribute
|
|
218
|
+
*
|
|
219
|
+
* The annotations:
|
|
220
|
+
* - Are positioned at the center of each interactable element
|
|
221
|
+
* - Have the same numeric value as the element's attribute
|
|
222
|
+
* - Are styled as black circles with red borders and white text
|
|
223
|
+
* - Are placed in a shadow DOM to avoid style conflicts with the page
|
|
224
|
+
* - Have the {@link interactableAnnotationAttribute} for identification
|
|
225
|
+
* - Are non-interactive (pointer-events: none)
|
|
226
|
+
*
|
|
227
|
+
* Note: This method requires elements to be previously attributed using the
|
|
228
|
+
* {@link attributeInteractableElements} method to find the elements to annotate.
|
|
229
|
+
*
|
|
230
|
+
* @param page - The Playwright Page object to process
|
|
231
|
+
* @returns {Promise<void>} A promise that resolves when all elements have been annotated
|
|
232
|
+
* @throws {PageClosedException} If the page is closed during processing
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* const inspector = new PageInspector();
|
|
236
|
+
* await inspector.attributeInteractableElements(page);
|
|
237
|
+
* await inspector.annotateInteractableElements(page);
|
|
238
|
+
*/
|
|
239
|
+
async annotateInteractableElements(page) {
|
|
240
|
+
try {
|
|
241
|
+
// Filter frames as needed
|
|
242
|
+
const frames = page
|
|
243
|
+
.frames()
|
|
244
|
+
.filter((frame) => PageInspector.frameFilter(frame));
|
|
245
|
+
for (const frame of frames) {
|
|
246
|
+
await frame.evaluate(([interactableAttr, annotationAttr]) => {
|
|
247
|
+
// 1) Ensure we have a shadow container in the main document
|
|
248
|
+
let container = document.getElementById('annotation-shadow-container');
|
|
249
|
+
if (!container) {
|
|
250
|
+
container = document.createElement('div');
|
|
251
|
+
container.id = 'annotation-shadow-container';
|
|
252
|
+
// Position container so child elements can be absolutely placed
|
|
253
|
+
Object.assign(container.style, {
|
|
254
|
+
position: 'absolute',
|
|
255
|
+
top: '0',
|
|
256
|
+
left: '0',
|
|
257
|
+
width: '100%',
|
|
258
|
+
height: '100%',
|
|
259
|
+
pointerEvents: 'none', // Let clicks pass through
|
|
260
|
+
zIndex: '2147483647', // win every z-index fight
|
|
261
|
+
});
|
|
262
|
+
// Check if document.body exists before trying to append.
|
|
263
|
+
if (document.body) {
|
|
264
|
+
document.body.appendChild(container);
|
|
265
|
+
}
|
|
266
|
+
else if (document.documentElement) {
|
|
267
|
+
// Fall back to document.documentElement if body does not exist.
|
|
268
|
+
document.documentElement.appendChild(container);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
// If neither exists, we can't proceed with annotations in this frame.
|
|
272
|
+
console.warn(`Cannot create annotation container for ${window.location.href} since the document structure is incomplete`);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
// Attach a shadow root
|
|
276
|
+
const shadowRoot = container.attachShadow({ mode: 'open' });
|
|
277
|
+
// Add a <style> element inside the shadow root to reset and define annotation styles
|
|
278
|
+
const style = document.createElement('style');
|
|
279
|
+
style.textContent = `
|
|
280
|
+
:host {
|
|
281
|
+
all: initial; /* Reset styles in shadow root */
|
|
282
|
+
}
|
|
283
|
+
.annotation {
|
|
284
|
+
position: absolute;
|
|
285
|
+
z-index: 2147483647;
|
|
286
|
+
background-color: black;
|
|
287
|
+
color: white;
|
|
288
|
+
width: 40px;
|
|
289
|
+
height: 40px;
|
|
290
|
+
border-radius: 50%;
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
justify-content: center;
|
|
294
|
+
font-size: 14px;
|
|
295
|
+
font-weight: bold;
|
|
296
|
+
line-height: 20px;
|
|
297
|
+
text-align: center;
|
|
298
|
+
box-shadow: 0px 2px 4px rgba(0,0,0,0.2);
|
|
299
|
+
border: 4px solid #FF4136;
|
|
300
|
+
pointer-events: none;
|
|
301
|
+
}
|
|
302
|
+
`;
|
|
303
|
+
shadowRoot.appendChild(style);
|
|
304
|
+
}
|
|
305
|
+
// Retrieve the shadow root to place annotation elements
|
|
306
|
+
const containerEl = document.getElementById('annotation-shadow-container');
|
|
307
|
+
if (!containerEl?.shadowRoot) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const shadowRoot = containerEl.shadowRoot;
|
|
311
|
+
// 2) Factory to create a new annotation inside the shadow root
|
|
312
|
+
const createAnnotation = (value) => {
|
|
313
|
+
const annotation = document.createElement('div');
|
|
314
|
+
annotation.classList.add('annotation');
|
|
315
|
+
annotation.dataset[annotationAttr] = '1';
|
|
316
|
+
annotation.textContent = value;
|
|
317
|
+
return annotation;
|
|
318
|
+
};
|
|
319
|
+
// 3) Position annotation relative to an element
|
|
320
|
+
const positionAnnotation = (annotation, element) => {
|
|
321
|
+
const rect = element.getBoundingClientRect();
|
|
322
|
+
// Center the annotation on the element, adjusting for its size
|
|
323
|
+
// Since container is absolute, we need to account for scroll position
|
|
324
|
+
const x = rect.left + rect.width / 2 - 20 + window.scrollX;
|
|
325
|
+
const y = rect.top + rect.height / 2 - 20 + window.scrollY;
|
|
326
|
+
annotation.style.left = `${x}px`;
|
|
327
|
+
annotation.style.top = `${y}px`;
|
|
328
|
+
};
|
|
329
|
+
// 4) Traverse DOM (including any nested shadow roots) to find interactable elements
|
|
330
|
+
const processNode = (root) => {
|
|
331
|
+
// Find elements with the interactable attribute
|
|
332
|
+
const elements = root.querySelectorAll(`[${interactableAttr}]`);
|
|
333
|
+
elements.forEach((element) => {
|
|
334
|
+
const value = element.getAttribute(interactableAttr);
|
|
335
|
+
if (value) {
|
|
336
|
+
const annotation = createAnnotation(value);
|
|
337
|
+
shadowRoot.appendChild(annotation);
|
|
338
|
+
positionAnnotation(annotation, element);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
// Recursively process any child shadow roots
|
|
342
|
+
root.querySelectorAll('*').forEach((el) => {
|
|
343
|
+
if (el.shadowRoot) {
|
|
344
|
+
processNode(el.shadowRoot);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
// Start processing from the (frame) document root
|
|
349
|
+
processNode(document);
|
|
350
|
+
}, [
|
|
351
|
+
this.interactableElementAttribute,
|
|
352
|
+
PageInspector.convertToJsAttribute(this.interactableAnnotationAttribute),
|
|
353
|
+
]);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
if (PlaywrightUtils_1.PlaywrightUtils.isPageClosedError(error)) {
|
|
358
|
+
throw new PageClosedException_1.PageClosedException();
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
throw error;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Removes all visual annotations from the page that were created by
|
|
367
|
+
* the {@link annotateInteractableElements} method.
|
|
368
|
+
*
|
|
369
|
+
* This method:
|
|
370
|
+
* 1. Processes all accessible frames in the page
|
|
371
|
+
* 2. Finds and removes the shadow DOM container with ID 'annotation-shadow-container'
|
|
372
|
+
* that contains all the annotations
|
|
373
|
+
*
|
|
374
|
+
* This effectively removes all numbered indicators that were previously placed
|
|
375
|
+
* over interactable elements, leaving the page in its original visual state.
|
|
376
|
+
* Note that this only removes the visual annotations, not the
|
|
377
|
+
* {@link interactableElementAttribute} attributes on the elements themselves.
|
|
378
|
+
*
|
|
379
|
+
* @param page - The Playwright Page object to process
|
|
380
|
+
* @returns {Promise<void>} A promise that resolves when all annotations have been removed
|
|
381
|
+
* @throws {PageClosedException} If the page is closed during processing
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* const inspector = new PageInspector();
|
|
385
|
+
* await inspector.attributeInteractableElements(page);
|
|
386
|
+
* await inspector.annotateInteractableElements(page);
|
|
387
|
+
* // ... do some operations with the annotations visible ...
|
|
388
|
+
* await inspector.removeDonobuAnnotations(page);
|
|
389
|
+
* // All visual annotations are now removed from the page
|
|
390
|
+
*/
|
|
391
|
+
async removeDonobuAnnotations(page) {
|
|
392
|
+
try {
|
|
393
|
+
const frames = page
|
|
394
|
+
.frames()
|
|
395
|
+
.filter((frame) => PageInspector.frameFilter(frame));
|
|
396
|
+
for (const frame of frames) {
|
|
397
|
+
await frame.evaluate(() => {
|
|
398
|
+
const containerId = 'annotation-shadow-container';
|
|
399
|
+
const container = document.getElementById(containerId);
|
|
400
|
+
if (container) {
|
|
401
|
+
container.remove();
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
if (PlaywrightUtils_1.PlaywrightUtils.isPageClosedError(error)) {
|
|
408
|
+
throw new PageClosedException_1.PageClosedException();
|
|
409
|
+
}
|
|
410
|
+
throw error;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Removes all interactable element attributes that were previously added to elements in the page.
|
|
415
|
+
*
|
|
416
|
+
* This method:
|
|
417
|
+
* 1. Processes all accessible frames in the page
|
|
418
|
+
* 2. Finds all elements with the {@link interactableElementAttribute} attribute
|
|
419
|
+
* 3. Removes this attribute from each element
|
|
420
|
+
*
|
|
421
|
+
* This effectively undoes the changes made by the {@link attributeInteractableElements} method,
|
|
422
|
+
* returning the page's DOM to its original state without the custom attributes.
|
|
423
|
+
* Note that this does not affect any visual annotations - to remove those, use
|
|
424
|
+
* the {@link removeDonobuAnnotations} method separately.
|
|
425
|
+
*
|
|
426
|
+
* This method is automatically called at the beginning of {@link attributeInteractableElements}
|
|
427
|
+
* to ensure a clean state before adding new attributes, but can also be called
|
|
428
|
+
* independently to clean up the DOM.
|
|
429
|
+
*
|
|
430
|
+
* @param page - The Playwright Page object to process
|
|
431
|
+
* @returns {Promise<void>} A promise that resolves when all attributes have been removed
|
|
432
|
+
* @throws {PageClosedException} If the page is closed during processing
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* const inspector = new PageInspector();
|
|
436
|
+
* await inspector.attributeInteractableElements(page);
|
|
437
|
+
* // ... perform operations with attributed elements ...
|
|
438
|
+
* await inspector.deattributeInteractableElements(page);
|
|
439
|
+
* // All interactable element attributes are now removed from the page
|
|
440
|
+
*/
|
|
441
|
+
async deattributeInteractableElements(page) {
|
|
442
|
+
try {
|
|
443
|
+
const frames = page
|
|
444
|
+
.frames()
|
|
445
|
+
.filter((frame) => PageInspector.frameFilter(frame));
|
|
446
|
+
for (const frame of frames) {
|
|
447
|
+
await frame.evaluate((attr) => {
|
|
448
|
+
document.querySelectorAll(`[${attr}]`).forEach((element) => {
|
|
449
|
+
element.removeAttribute(attr);
|
|
450
|
+
});
|
|
451
|
+
}, this.interactableElementAttribute);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
catch (error) {
|
|
455
|
+
if (PlaywrightUtils_1.PlaywrightUtils.isPageClosedError(error)) {
|
|
456
|
+
throw new PageClosedException_1.PageClosedException();
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
throw error;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Converts an HTML attribute to a JavaScript attribute. For example,
|
|
465
|
+
* "data-foo-bar" is turned into "fooBar". Notice the dropping of the "data-"
|
|
466
|
+
* prefix, and the conversion from kebab-case to camelCase.
|
|
467
|
+
*/
|
|
468
|
+
static convertToJsAttribute(htmlAttribute) {
|
|
469
|
+
if (htmlAttribute.startsWith('data-')) {
|
|
470
|
+
htmlAttribute = htmlAttribute.substring(5);
|
|
471
|
+
}
|
|
472
|
+
const parts = htmlAttribute.split('-');
|
|
473
|
+
const jsAttribute = parts[0] +
|
|
474
|
+
parts
|
|
475
|
+
.slice(1)
|
|
476
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase())
|
|
477
|
+
.join('');
|
|
478
|
+
return jsAttribute;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* An internal method that is injected into page/frame contexts to find and attribute interactable elements.
|
|
482
|
+
*
|
|
483
|
+
* This method:
|
|
484
|
+
* 1. Identifies potentially interactable elements using a comprehensive selector
|
|
485
|
+
* 2. Filters elements based on visibility, position in viewport, and interactability
|
|
486
|
+
* 3. Assigns unique sequential numeric values to the interactable attribute
|
|
487
|
+
*
|
|
488
|
+
* The method uses several criteria to determine if an element is truly interactable:
|
|
489
|
+
* - Element must be visible (non-zero dimensions, not hidden via CSS)
|
|
490
|
+
* - Element must have at least 50% of its area within the viewport
|
|
491
|
+
* - Element must not be disabled, inert, or have pointer-events:none
|
|
492
|
+
* - Element must be the topmost element at its coordinates (using point sampling)
|
|
493
|
+
*
|
|
494
|
+
* Special handling is provided for label elements, which will attribute their
|
|
495
|
+
* associated form controls as well.
|
|
496
|
+
*
|
|
497
|
+
* This method can process both standard DOM elements and elements within shadow roots,
|
|
498
|
+
* ensuring thorough coverage of modern web applications.
|
|
499
|
+
*
|
|
500
|
+
* @param arg - A tuple containing [offset: number, interactableAttribute: string]
|
|
501
|
+
* where offset is the starting value for sequential numbering and
|
|
502
|
+
* interactableAttribute is the attribute name to assign
|
|
503
|
+
* @returns The updated offset after assigning attributes (for sequential numbering across frames)
|
|
504
|
+
* @private
|
|
505
|
+
*
|
|
506
|
+
* @remarks
|
|
507
|
+
* This method is designed to be injected into the page context using page.evaluate()
|
|
508
|
+
* and should not be called directly from Node.js code.
|
|
509
|
+
*/
|
|
510
|
+
static attributeElementsInContext(arg) {
|
|
511
|
+
let offset = arg[0];
|
|
512
|
+
const interactableAttribute = arg[1];
|
|
513
|
+
// --- Utility Functions ---
|
|
514
|
+
function isElementVisible(rect, style) {
|
|
515
|
+
return (rect.width > 0 &&
|
|
516
|
+
rect.height > 0 &&
|
|
517
|
+
style.display !== 'none' &&
|
|
518
|
+
style.visibility !== 'hidden');
|
|
519
|
+
}
|
|
520
|
+
function isElementMoreThanHalfInViewport(rect) {
|
|
521
|
+
const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
522
|
+
const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
523
|
+
const visibleWidth = Math.min(rect.right, viewportWidth) - Math.max(rect.left, 0);
|
|
524
|
+
const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);
|
|
525
|
+
const visibleArea = Math.max(0, visibleWidth) * Math.max(0, visibleHeight);
|
|
526
|
+
const elementArea = rect.width * rect.height;
|
|
527
|
+
return visibleArea >= elementArea / 2;
|
|
528
|
+
}
|
|
529
|
+
function isElementEnabled(element, style) {
|
|
530
|
+
// Check standard disabled attribute (for form controls like button, input, etc.)
|
|
531
|
+
if (element.hasAttribute('disabled')) {
|
|
532
|
+
return false;
|
|
533
|
+
}
|
|
534
|
+
// Check for ARIA attributes that indicate non-interactivity
|
|
535
|
+
if (element.getAttribute('aria-disabled') === 'true' ||
|
|
536
|
+
element.getAttribute('aria-hidden') === 'true') {
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
// Check for pointer-events: none which prevents interactions
|
|
540
|
+
if (style.pointerEvents === 'none') {
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
// Check for ARIA attributes indicating disabled state
|
|
544
|
+
if (element.getAttribute('aria-disabled') === 'true') {
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
// Check for inert attribute which makes elements non-interactive
|
|
548
|
+
if (element.hasAttribute('inert')) {
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
// If the element is in a form and the fieldset is disabled, it might be disabled as well
|
|
552
|
+
let parent = element.parentElement;
|
|
553
|
+
while (parent) {
|
|
554
|
+
if (parent.tagName.toLowerCase() === 'fieldset' &&
|
|
555
|
+
parent.hasAttribute('disabled') &&
|
|
556
|
+
element.tagName.toLowerCase() !== 'legend') {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
parent = parent.parentElement;
|
|
560
|
+
}
|
|
561
|
+
return true;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Generate a few test points on the element's bounding box. We only need
|
|
565
|
+
* a small offset (1px) from each corner, plus the center.
|
|
566
|
+
*/
|
|
567
|
+
function getPointsToCheck(rect) {
|
|
568
|
+
const cornerOffset = 1;
|
|
569
|
+
return [
|
|
570
|
+
{ x: rect.left + cornerOffset, y: rect.top + cornerOffset },
|
|
571
|
+
{ x: rect.right - cornerOffset, y: rect.top + cornerOffset },
|
|
572
|
+
{ x: rect.left + cornerOffset, y: rect.bottom - cornerOffset },
|
|
573
|
+
{ x: rect.right - cornerOffset, y: rect.bottom - cornerOffset },
|
|
574
|
+
{ x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 },
|
|
575
|
+
];
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Like `elementFromPoint` but continues walking shadow roots if found.
|
|
579
|
+
*/
|
|
580
|
+
function getDeepElementFromPoint(x, y) {
|
|
581
|
+
let el = document.elementFromPoint(x, y);
|
|
582
|
+
while (el && el.shadowRoot) {
|
|
583
|
+
const shadowEl = el.shadowRoot.elementFromPoint(x, y);
|
|
584
|
+
if (!shadowEl || shadowEl === el)
|
|
585
|
+
break;
|
|
586
|
+
el = shadowEl;
|
|
587
|
+
}
|
|
588
|
+
return el;
|
|
589
|
+
}
|
|
590
|
+
function getAllInteractableElements(root) {
|
|
591
|
+
const selector = [
|
|
592
|
+
// ----- STANDARD HTML INTERACTIVE ELEMENTS -----
|
|
593
|
+
// Basic form controls and interactive elements
|
|
594
|
+
'button',
|
|
595
|
+
'button svg', // SVG inside buttons are also clickable
|
|
596
|
+
'input',
|
|
597
|
+
'textarea',
|
|
598
|
+
'a',
|
|
599
|
+
'select',
|
|
600
|
+
'summary', // Disclosure (details/summary) elements
|
|
601
|
+
'details',
|
|
602
|
+
'audio[controls]', // Media controls
|
|
603
|
+
'video[controls]',
|
|
604
|
+
// ----- ARIA ROLE-BASED INTERACTIVE ELEMENTS -----
|
|
605
|
+
// Elements with explicit interactive ARIA roles
|
|
606
|
+
'[role="button"]',
|
|
607
|
+
'[role="option"]',
|
|
608
|
+
'[role="link"]',
|
|
609
|
+
'[role="checkbox"]',
|
|
610
|
+
'[role="radio"]',
|
|
611
|
+
'[role="tab"]',
|
|
612
|
+
'[role="menuitem"]',
|
|
613
|
+
'[role="menuitemcheckbox"]',
|
|
614
|
+
'[role="menuitemradio"]',
|
|
615
|
+
'[role="combobox"]',
|
|
616
|
+
'[role="listbox"]',
|
|
617
|
+
'[role="searchbox"]',
|
|
618
|
+
'[role="spinbutton"]',
|
|
619
|
+
'[role="slider"]',
|
|
620
|
+
'[role="switch"]',
|
|
621
|
+
'[role="menu"]',
|
|
622
|
+
'[role="menubar"]',
|
|
623
|
+
'[role="treeitem"]',
|
|
624
|
+
// ----- INTERACTIVE ARIA ATTRIBUTES -----
|
|
625
|
+
// Elements with popup behavior
|
|
626
|
+
'[aria-haspopup]',
|
|
627
|
+
'[aria-controls]',
|
|
628
|
+
'[aria-expanded]', // Elements that can expand/collapse
|
|
629
|
+
'[aria-pressed]', // Toggle buttons
|
|
630
|
+
'[aria-selected]', // Selectable items
|
|
631
|
+
// ----- EDITABLE AND FOCUSABLE ELEMENTS -----
|
|
632
|
+
// Elements that can receive input
|
|
633
|
+
'[contenteditable="true"]',
|
|
634
|
+
// Elements that can be dragged
|
|
635
|
+
'[draggable="true"]',
|
|
636
|
+
// Elements with explicit focus capability
|
|
637
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
638
|
+
// ----- CSS FRAMEWORK-SPECIFIC CLASSES -----
|
|
639
|
+
// Bootstrap & similar frameworks
|
|
640
|
+
'.btn', // Standard button class
|
|
641
|
+
'.dropdown-toggle', // Dropdown triggers
|
|
642
|
+
'.nav-link', // Navigation links
|
|
643
|
+
'.page-link', // Pagination links
|
|
644
|
+
'.card-header[data-toggle="collapse"]', // Collapsible headers
|
|
645
|
+
'.accordion-button', // Accordion toggles
|
|
646
|
+
'.close', // Close buttons
|
|
647
|
+
'.modal-close', // Modal close buttons
|
|
648
|
+
// Material Design & Angular Material
|
|
649
|
+
'.mdc-button',
|
|
650
|
+
'.mat-button',
|
|
651
|
+
'.mat-icon-button',
|
|
652
|
+
'.mat-fab',
|
|
653
|
+
'.mat-mini-fab',
|
|
654
|
+
'.mat-menu-item',
|
|
655
|
+
'.mat-tab-label',
|
|
656
|
+
// Foundation
|
|
657
|
+
'.button',
|
|
658
|
+
'.menu-item',
|
|
659
|
+
'.accordion-title',
|
|
660
|
+
// Tailwind UI & Headless UI components
|
|
661
|
+
'.tw-button',
|
|
662
|
+
'[x-on\\:click]', // Alpine.js click handlers
|
|
663
|
+
// Vue-based frameworks
|
|
664
|
+
'.v-btn', // Vuetify
|
|
665
|
+
'.el-button', // Element UI
|
|
666
|
+
// React-based frameworks
|
|
667
|
+
'.ant-btn', // Ant Design
|
|
668
|
+
'.chakra-button', // Chakra UI
|
|
669
|
+
'.mui-button', // Material-UI
|
|
670
|
+
// ----- CUSTOM INTERACTIVE PATTERNS -----
|
|
671
|
+
// Common custom interactive classes
|
|
672
|
+
'.clickable',
|
|
673
|
+
'.selectable',
|
|
674
|
+
'.interactive',
|
|
675
|
+
'.toggle',
|
|
676
|
+
'.expandable',
|
|
677
|
+
'.switch',
|
|
678
|
+
'.slider',
|
|
679
|
+
// Common dropdown/select libraries
|
|
680
|
+
'.select2-selection',
|
|
681
|
+
'.chosen-single',
|
|
682
|
+
'.vs__dropdown-toggle', // Vue Select
|
|
683
|
+
// Tabs and accordion components
|
|
684
|
+
'.tab',
|
|
685
|
+
'.tab-header',
|
|
686
|
+
'.tab-title',
|
|
687
|
+
'.accordion-header',
|
|
688
|
+
// Mobile-friendly interactive elements
|
|
689
|
+
'.swipe-item',
|
|
690
|
+
'.touch-target',
|
|
691
|
+
// ----- COMMON COMPONENT PATTERNS -----
|
|
692
|
+
// Cards and tiles that are often clickable
|
|
693
|
+
'.card[onclick]',
|
|
694
|
+
'.tile[onclick]',
|
|
695
|
+
'.card a', // Links inside cards
|
|
696
|
+
// Social media & e-commerce patterns
|
|
697
|
+
'.share-button',
|
|
698
|
+
'.like-button',
|
|
699
|
+
'.add-to-cart',
|
|
700
|
+
'.product-card',
|
|
701
|
+
// Notification and alert controls
|
|
702
|
+
'.alert .close',
|
|
703
|
+
'.toast .close',
|
|
704
|
+
'.notification-action',
|
|
705
|
+
].join(', ');
|
|
706
|
+
let elements = Array.from(root.querySelectorAll(selector));
|
|
707
|
+
// Dive into shadow roots
|
|
708
|
+
root.querySelectorAll('*').forEach((el) => {
|
|
709
|
+
if (el.shadowRoot) {
|
|
710
|
+
// Recurse
|
|
711
|
+
elements = elements.concat(getAllInteractableElements(el.shadowRoot));
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
// Remove duplicates
|
|
715
|
+
return Array.from(new Set(elements));
|
|
716
|
+
}
|
|
717
|
+
// 1) Gather candidate elements
|
|
718
|
+
const interactableElements = getAllInteractableElements(document)
|
|
719
|
+
.concat(window.__donobu.getInteractiveElements())
|
|
720
|
+
.filter((el) => !el.id || (typeof el.id === 'string' && !el.id.startsWith('donobu-')));
|
|
721
|
+
// Use a Set to avoid duplicates
|
|
722
|
+
const uniqueElements = new Set(interactableElements);
|
|
723
|
+
// 2) Check each element for visibility + actual "interactability"
|
|
724
|
+
uniqueElements.forEach((element) => {
|
|
725
|
+
if (typeof element.getBoundingClientRect !== 'function') {
|
|
726
|
+
// Should be rare, but just in case
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
const rect = element.getBoundingClientRect();
|
|
730
|
+
const style = window.getComputedStyle(element);
|
|
731
|
+
const visible = isElementVisible(rect, style) && isElementMoreThanHalfInViewport(rect);
|
|
732
|
+
// Check if the element is actually enabled/interactive
|
|
733
|
+
const enabled = isElementEnabled(element, style);
|
|
734
|
+
if (!visible || !enabled) {
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
let annotated = false;
|
|
738
|
+
// 3) Test small set of points on the element to confirm it's truly topmost
|
|
739
|
+
for (const pt of getPointsToCheck(rect)) {
|
|
740
|
+
let elToCheck = getDeepElementFromPoint(pt.x, pt.y);
|
|
741
|
+
// Walk up the DOM tree from that point
|
|
742
|
+
while (elToCheck) {
|
|
743
|
+
if (elToCheck === element) {
|
|
744
|
+
// Found the actual element
|
|
745
|
+
element.setAttribute(interactableAttribute, offset.toString());
|
|
746
|
+
offset++;
|
|
747
|
+
annotated = true;
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
else if (elToCheck.tagName?.toLowerCase() === 'label' &&
|
|
751
|
+
elToCheck.htmlFor) {
|
|
752
|
+
// If we found a label referencing an element, also mark that
|
|
753
|
+
const forId = elToCheck.htmlFor;
|
|
754
|
+
const associatedInput = document.getElementById(forId);
|
|
755
|
+
if (associatedInput) {
|
|
756
|
+
associatedInput.setAttribute(interactableAttribute, offset.toString());
|
|
757
|
+
offset++;
|
|
758
|
+
}
|
|
759
|
+
annotated = true;
|
|
760
|
+
break;
|
|
761
|
+
}
|
|
762
|
+
elToCheck = elToCheck.parentElement;
|
|
763
|
+
}
|
|
764
|
+
if (annotated) {
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
return offset;
|
|
770
|
+
}
|
|
771
|
+
static frameFilter(frame) {
|
|
772
|
+
return (!frame.isDetached() &&
|
|
773
|
+
!frame.url().startsWith('about:') &&
|
|
774
|
+
!frame.url().startsWith('chrome:') &&
|
|
775
|
+
!frame.url().startsWith('edge:'));
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
exports.PageInspector = PageInspector;
|
|
779
|
+
/**
|
|
780
|
+
* A JavaScript code snippet intended to run as an initialization
|
|
781
|
+
* script for `DonobuFlow` flows. This script helps other scripts to know
|
|
782
|
+
* non-traditional interactive elements via calling the
|
|
783
|
+
* {@link window.__donobu.getInteractiveElements} function.
|
|
784
|
+
*/
|
|
785
|
+
PageInspector.INIT_SCRIPT = MiscUtils_1.MiscUtils.getResourceFileAsString(path_1.default.join('interactive-elements-tracker.js'));
|
|
786
|
+
//# sourceMappingURL=PageInspector.js.map
|