@probolabs/playwright 0.4.21 → 1.0.2

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/README.md CHANGED
@@ -1,136 +1,227 @@
1
- # Probolib: drive your playwright scripts with AI superpowers
2
-
3
- Probolib is a powerful AI-driven automation library that enhances Playwright testing and automation by making your scripts more robust and maintainable. Instead of relying on brittle CSS selectors or complex XPath expressions, Probolib uses natural language to interact with web elements.
4
-
5
- ## Why Probolib?
6
-
7
- - **Natural Language Automation**: Write human-readable instructions instead of complex selectors
8
- - **More Resilient Tests**: AI-powered element detection that adapts to UI changes
9
- - **Simpler Maintenance**: Reduce the need to update selectors when the UI changes
10
- - **Faster Development**: Write automation scripts in plain English
11
-
12
- ## Example
13
-
14
- Instead of writing:
15
-
16
- ```
17
- page.click('some > super > complex > css > and non robust selector')
18
- ```
19
-
20
- You can simply write:
21
-
22
- ```
23
- probo.runStep(page, 'click on the save button')
24
- ```
25
-
26
- ## Quickstart
27
-
28
- ```
29
- npm install @probolabs/playwright
30
- ```
31
-
32
- ## Accessing our backend
33
-
34
- the heavy lifting of the AI reasoning is done at the moment on our backend server. in order to access it you would need to tell the library how to access it.
35
-
36
- ## easyiest - set ENV var
37
-
38
- probolib expects the existance of 2 env vars:
39
-
40
- ```
41
- export PROBO_API_ENDPOINT=api.probolabs.ai
42
- export PROBO_API_KEY=<api key we will give you>
43
-
44
- ```
45
-
46
- Or use dotenv
47
-
48
- ```
49
- // npm install dotenv
50
- // in your script add this line
51
- import 'dotenv/config' // ES6
52
-
53
- // .env file located in the root of your project (the same level as your package.json)
54
- PROBO_API_ENDPOINT=https://api.probolabs.ai
55
- PROBO_API_KEY=<api key we will give you>
56
-
57
- ```
58
-
59
- ## A complete example for Playwright integration. step by step
60
-
61
- **step 1:** init a playwright project
62
-
63
- ```
64
- # from your work directory
65
- mkdir probo-example
66
- cd probo-example
67
- npm init playwright@latest
68
- # follow the instructions and wait till the installation is finished
69
- # verify that playwright is installed properly
70
- npx playwright test --project chromium
71
- ```
72
-
73
- **step 2**: integrate probolabs
74
-
75
- ```
76
- npm install @probolabs/playwright dotenv
77
- ```
78
-
79
- **step 3:** configure the env with our endpoint and api key
80
-
81
- ```
82
- touch .env
83
- ```
84
-
85
- edit the .env file
86
-
87
- ```
88
- #.env
89
- PROBO_API_ENDPOINT=https://api.probolabs.ai
90
- PROBO_API_KEY=<api key we will give you>
91
-
92
- ```
93
-
94
- **step 4:** create a file under the tests folder named `probo-example-todo-mvc.spec.mjs`
95
-
96
- ```
97
- // tests/probo-example-todo-mvc.spec.mjs
98
- import 'dotenv/config';
99
- import { test} from '@playwright/test';
100
- import { Probo } from '@probolabs/playwright';
101
-
102
- //
103
- // Important: Before running this script set PROBO_API_KEY and PROBO_API_ENDPOINT
104
- //
105
-
106
- test.describe('Todo MVC', () => {
107
- test('basic example', async ({ page }) => {
108
- try {
109
- // Initialize Probo
110
- const probo = new Probo({
111
- scenarioName: 'probo-example-todo-mvc' // important for caching the AI reasoning
112
- });
113
-
114
- //Goto page
115
- await page.goto('https://demo.playwright.dev/todomvc');
116
-
117
- // Run test steps
118
- console.log('Running test steps...');
119
- await probo.runStep(page, 'enter a new todo item: "Buy groceries"');
120
- await probo.runStep(page, 'press the Enter key');
121
-
122
- console.log('✨ Test completed successfully!');
123
- } catch (error) {
124
- console.error('❌ Test failed:', error);
125
- throw error; // Re-throw to mark the test as failed
126
- }
127
- });
128
- });
129
-
130
- ```
131
-
132
- **run the example**
133
-
134
- ```
135
- npx playwright test tests/probo-example-todo-mvc.spec.mjs --headed --project chromium
136
- ```
1
+ # Probolib: drive your playwright scripts with AI superpowers
2
+
3
+ Probolib is a powerful AI-driven automation library that enhances Playwright testing and automation by making your scripts more robust and maintainable. Instead of relying on brittle CSS selectors or complex XPath expressions, Probolib uses natural language to interact with web elements.
4
+
5
+ ## Why Probolib?
6
+
7
+ - **Natural Language Automation**: Write human-readable instructions instead of complex selectors
8
+ - **More Resilient Tests**: AI-powered element detection that adapts to UI changes
9
+ - **Simpler Maintenance**: Reduce the need to update selectors when the UI changes
10
+ - **Faster Development**: Write automation scripts in plain English
11
+
12
+ ## Example
13
+
14
+ Instead of writing:
15
+
16
+ ```
17
+ page.click('some > super > complex > css > and non robust selector')
18
+ ```
19
+
20
+ You can simply write:
21
+
22
+ ```
23
+ probo.runStep(page, 'click on the save button')
24
+ ```
25
+
26
+ ## Quickstart
27
+
28
+ ```
29
+ npm install @probolabs/playwright
30
+ ```
31
+
32
+ ## Accessing our backend
33
+
34
+ the heavy lifting of the AI reasoning is done at the moment on our backend server. in order to access it you would need to tell the library how to access it.
35
+
36
+ ## easyiest - set ENV var
37
+
38
+ probolib expects the existance of 2 env vars:
39
+
40
+ ```
41
+ export PROBO_API_ENDPOINT=api.probolabs.ai
42
+ export PROBO_API_KEY=<api key we will give you>
43
+
44
+ ```
45
+
46
+ Or use dotenv
47
+
48
+ ```
49
+ // npm install dotenv
50
+ // in your script add this line
51
+ import 'dotenv/config' // ES6
52
+
53
+ // .env file located in the root of your project (the same level as your package.json)
54
+ PROBO_API_ENDPOINT=https://api.probolabs.ai
55
+ PROBO_API_KEY=<api key we will give you>
56
+
57
+ ```
58
+
59
+ ## A complete example for Playwright integration. step by step
60
+
61
+ **step 1:** init a playwright project
62
+
63
+ ```
64
+ # from your work directory
65
+ mkdir probo-example
66
+ cd probo-example
67
+ npm init playwright@latest
68
+ # follow the instructions and wait till the installation is finished
69
+ # verify that playwright is installed properly
70
+ npx playwright test --project chromium
71
+ ```
72
+
73
+ **step 2**: integrate probolabs
74
+
75
+ ```
76
+ npm install @probolabs/playwright dotenv
77
+ ```
78
+
79
+ **step 3:** configure the env with our endpoint and api key
80
+
81
+ ```
82
+ touch .env
83
+ ```
84
+
85
+ edit the .env file
86
+
87
+ ```
88
+ #.env
89
+ PROBO_API_ENDPOINT=https://api.probolabs.ai
90
+ PROBO_API_KEY=<api key we will give you>
91
+
92
+ ```
93
+
94
+ **step 4:** create a file under the tests folder named `probo-example-todo-mvc.spec.mjs`
95
+
96
+ ```
97
+ // tests/probo-example-todo-mvc.spec.mjs
98
+ import 'dotenv/config';
99
+ import { test} from '@playwright/test';
100
+ import { Probo } from '@probolabs/playwright';
101
+
102
+ //
103
+ // Important: Before running this script set PROBO_API_KEY and PROBO_API_ENDPOINT
104
+ //
105
+
106
+ test.describe('Todo MVC', () => {
107
+ test('basic example', async ({ page }) => {
108
+ try {
109
+ // Initialize Probo
110
+ const probo = new Probo({
111
+ scenarioName: 'probo-example-todo-mvc' // important for caching the AI reasoning
112
+ });
113
+
114
+ //Goto page
115
+ await page.goto('https://demo.playwright.dev/todomvc');
116
+
117
+ // Run test steps
118
+ console.log('Running test steps...');
119
+ await probo.runStep(page, 'enter a new todo item: "Buy groceries"');
120
+ await probo.runStep(page, 'press the Enter key');
121
+
122
+ console.log('✨ Test completed successfully!');
123
+ } catch (error) {
124
+ console.error('❌ Test failed:', error);
125
+ throw error; // Re-throw to mark the test as failed
126
+ }
127
+ });
128
+ });
129
+
130
+ ```
131
+
132
+ **run the example**
133
+
134
+ ```
135
+ npx playwright test tests/probo-example-todo-mvc.spec.mjs --headed --project chromium
136
+ ```
137
+
138
+ ## Using Probo Fixtures (Connect to Existing Browser)
139
+
140
+ Probo fixtures allow you to connect to an existing Chrome instance (like your recorder app) instead of launching a new browser. This is useful when you want to run tests against a browser that's already running with specific extensions or configurations.
141
+
142
+ ### Quick Setup
143
+
144
+ **Step 1:** Install the package
145
+
146
+ ```bash
147
+ npm install @probolabs/playwright
148
+ ```
149
+
150
+ **Step 2:** Create a `playwright.config.ts` file
151
+
152
+ ```typescript
153
+ // playwright.config.ts
154
+ import { defineConfig } from "@playwright/test";
155
+
156
+ export default defineConfig({
157
+ testDir: "./tests",
158
+ use: {
159
+ // Don't launch a new browser - Probo fixtures will connect to existing one
160
+ launchOptions: {},
161
+ },
162
+ workers: 1, // Use 1 worker to avoid conflicts with existing browser
163
+ });
164
+ ```
165
+
166
+ **Step 3:** Use Probo fixtures in your test files
167
+
168
+ ```typescript
169
+ // tests/example.spec.ts
170
+ import { test, expect } from "@probolabs/playwright/fixtures";
171
+
172
+ test.describe("My Tests", () => {
173
+ test("should work with existing browser", async ({ page }) => {
174
+ // This page comes from your existing Chrome instance
175
+ await page.goto("https://example.com");
176
+ await page.click("button");
177
+
178
+ // Your test code here...
179
+ });
180
+ });
181
+ ```
182
+
183
+ **Step 4:** Make sure your recorder app is running, then run tests
184
+
185
+ ```bash
186
+ npx playwright test
187
+ ```
188
+
189
+ ### Advanced Configuration
190
+
191
+ You can customize the fixtures with different options:
192
+
193
+ ```typescript
194
+ // tests/example.spec.ts
195
+ import { createProboFixtures, expect } from "@probolabs/playwright/fixtures";
196
+
197
+ // Create custom fixtures with specific configuration
198
+ const test = createProboFixtures({
199
+ debugPort: 9333, // Default port where your recorder app runs
200
+ showBrowserConsole: true, // Show browser console logs
201
+ });
202
+
203
+ test.describe("My Tests", () => {
204
+ test("custom configuration", async ({ page }) => {
205
+ // Your test code here...
206
+ });
207
+ });
208
+ ```
209
+
210
+ ### Requirements
211
+
212
+ - Your recorder app must be running with Chrome accessible via CDP
213
+ - Chrome must be launched with `--remote-debugging-port=9333` (or your custom port)
214
+ - The browser must have at least one page open (not just extension pages)
215
+
216
+ ### Troubleshooting
217
+
218
+ **Error: "No browser context found"**
219
+
220
+ - Make sure your recorder app is running
221
+ - Check that Chrome is accessible at `http://localhost:9333`
222
+ - Verify the debug port matches your configuration
223
+
224
+ **Error: "No main page found"**
225
+
226
+ - Make sure your recorder app has opened a page
227
+ - The page should not be a chrome-extension:// URL
@@ -0,0 +1,28 @@
1
+ import * as _playwright_test from '@playwright/test';
2
+ export { expect } from '@playwright/test';
3
+
4
+ /**
5
+ * Configuration options for Probo fixtures
6
+ */
7
+ interface ProboFixturesConfig {
8
+ /** The debug port where your recorder app's Chrome instance is running */
9
+ debugPort?: number;
10
+ /** Whether to show browser console logs */
11
+ showBrowserConsole?: boolean;
12
+ }
13
+ /**
14
+ * Creates Probo fixtures that connect to an existing Chrome instance
15
+ * instead of launching a new browser.
16
+ *
17
+ * @param config Configuration options for the fixtures
18
+ * @returns Extended test function with Probo fixtures
19
+ */
20
+ declare function createProboFixtures(config?: ProboFixturesConfig): _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
21
+ /**
22
+ * Default Probo fixtures with standard configuration
23
+ * Connects to Chrome instance running on port 9333
24
+ */
25
+ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
26
+
27
+ export { createProboFixtures, test };
28
+ export type { ProboFixturesConfig };
@@ -0,0 +1,52 @@
1
+ import { test as test$1, chromium } from '@playwright/test';
2
+ export { expect } from '@playwright/test';
3
+
4
+ /**
5
+ * Creates Probo fixtures that connect to an existing Chrome instance
6
+ * instead of launching a new browser.
7
+ *
8
+ * @param config Configuration options for the fixtures
9
+ * @returns Extended test function with Probo fixtures
10
+ */
11
+ function createProboFixtures(config = {}) {
12
+ const { debugPort = 9333, showBrowserConsole = false } = config;
13
+ return test$1.extend({
14
+ browser: async ({}, use) => {
15
+ // Connect to your existing recorder app's browser
16
+ const browser = await chromium.connectOverCDP(`http://localhost:${debugPort}`);
17
+ // Get the existing browser context (the one from your recorder app)
18
+ const context = browser.contexts()[0];
19
+ if (!context) {
20
+ throw new Error(`No browser context found at http://localhost:${debugPort}. Make sure your recorder app is running.`);
21
+ }
22
+ // Use the existing context
23
+ await use(browser);
24
+ // Don't close the browser - it's managed by your recorder app
25
+ },
26
+ // Override the page fixture to use existing page
27
+ page: async ({ browser }, use) => {
28
+ const context = browser.contexts()[0];
29
+ const allPages = context.pages();
30
+ // Find the main page (not chrome-extension pages)
31
+ const mainPage = allPages.find(page => !page.url().startsWith('chrome-extension://'));
32
+ if (!mainPage) {
33
+ throw new Error('No main page found in existing browser context. Make sure your recorder app has opened a page.');
34
+ }
35
+ // Set up console logging if requested
36
+ if (showBrowserConsole) {
37
+ mainPage.on('console', msg => console.log('Browser console:', msg.text()));
38
+ }
39
+ // Use the existing page
40
+ await use(mainPage);
41
+ // Don't close the page - it's managed by your recorder app
42
+ },
43
+ });
44
+ }
45
+ /**
46
+ * Default Probo fixtures with standard configuration
47
+ * Connects to Chrome instance running on port 9333
48
+ */
49
+ const test = createProboFixtures();
50
+
51
+ export { createProboFixtures, test };
52
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.js","sources":["../src/fixtures.ts"],"sourcesContent":["import { test as base, chromium } from '@playwright/test';\n\n/**\n * Configuration options for Probo fixtures\n */\nexport interface ProboFixturesConfig {\n /** The debug port where your recorder app's Chrome instance is running */\n debugPort?: number;\n /** Whether to show browser console logs */\n showBrowserConsole?: boolean;\n}\n\n/**\n * Creates Probo fixtures that connect to an existing Chrome instance\n * instead of launching a new browser.\n * \n * @param config Configuration options for the fixtures\n * @returns Extended test function with Probo fixtures\n */\nexport function createProboFixtures(config: ProboFixturesConfig = {}) {\n const { debugPort = 9333, showBrowserConsole = false } = config;\n\n return base.extend({\n browser: async ({}, use) => {\n // Connect to your existing recorder app's browser\n const browser = await chromium.connectOverCDP(`http://localhost:${debugPort}`);\n \n // Get the existing browser context (the one from your recorder app)\n const context = browser.contexts()[0];\n \n if (!context) {\n throw new Error(`No browser context found at http://localhost:${debugPort}. Make sure your recorder app is running.`);\n }\n \n // Use the existing context\n await use(browser);\n \n // Don't close the browser - it's managed by your recorder app\n },\n \n // Override the page fixture to use existing page\n page: async ({ browser }, use) => {\n const context = browser.contexts()[0];\n const allPages = context.pages();\n \n // Find the main page (not chrome-extension pages)\n const mainPage = allPages.find(page => !page.url().startsWith('chrome-extension://'));\n \n if (!mainPage) {\n throw new Error('No main page found in existing browser context. Make sure your recorder app has opened a page.');\n }\n \n // Set up console logging if requested\n if (showBrowserConsole) {\n mainPage.on('console', msg => console.log('Browser console:', msg.text()));\n }\n \n // Use the existing page\n await use(mainPage);\n \n // Don't close the page - it's managed by your recorder app\n },\n });\n}\n\n/**\n * Default Probo fixtures with standard configuration\n * Connects to Chrome instance running on port 9333\n */\nexport const test = createProboFixtures();\n\n/**\n * Re-export expect from Playwright for convenience\n */\nexport { expect } from '@playwright/test';\n"],"names":["base"],"mappings":";;;AAYA;;;;;;AAMG;AACa,SAAA,mBAAmB,CAAC,MAAA,GAA8B,EAAE,EAAA;IAClE,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,kBAAkB,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;IAEhE,OAAOA,MAAI,CAAC,MAAM,CAAC;AACjB,QAAA,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,KAAI;;YAEzB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,cAAc,CAAC,CAAoB,iBAAA,EAAA,SAAS,CAAE,CAAA,CAAC,CAAC;;YAG/E,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;YAEtC,IAAI,CAAC,OAAO,EAAE;AACZ,gBAAA,MAAM,IAAI,KAAK,CAAC,gDAAgD,SAAS,CAAA,yCAAA,CAA2C,CAAC,CAAC;aACvH;;AAGD,YAAA,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC;;SAGpB;;QAGD,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,KAAI;YAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;AACtC,YAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;;YAGjC,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC;YAEtF,IAAI,CAAC,QAAQ,EAAE;AACb,gBAAA,MAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC,CAAC;aACnH;;YAGD,IAAI,kBAAkB,EAAE;gBACtB,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;aAC5E;;AAGD,YAAA,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC;;SAGrB;AACF,KAAA,CAAC,CAAC;AACL,CAAC;AAED;;;AAGG;AACU,MAAA,IAAI,GAAG,mBAAmB;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,16 +1,10 @@
1
- import { Page, Locator } from 'playwright';
2
- import { PlaywrightAction, ElementTag, PlaywrightTimeoutConfig, AIModel, ServerResponse, ProboLogLevel } from '@probolabs/probo-shared';
1
+ import { Locator, Page } from 'playwright';
2
+ import { ElementTag, PlaywrightTimeoutConfig, PlaywrightAction, AIModel, InitialPageState, FindCandidateInput, ServerResponse, ProboLogLevel } from '@probolabs/probo-shared';
3
3
  export { ElementInfo, ElementTag, PlaywrightAction, ProboLogLevel } from '@probolabs/probo-shared';
4
+ import * as _playwright_test from '@playwright/test';
4
5
  import { Page as Page$1 } from '@playwright/test';
6
+ export { expect } from '@playwright/test';
5
7
 
6
- /**
7
- * Execute a given Playwright action, mirroring Python's _perform_action
8
- */
9
- declare function executePlaywrightAction(page: Page, action: PlaywrightAction, value: string | boolean, iframe_selector: string, element_css_selector: string): Promise<boolean | string>;
10
- /**
11
- * Execute a given Playwright action using native Playwright functions where possible
12
- */
13
- declare function executeCachedPlaywrightAction(page: Page, action: PlaywrightAction, value: string | boolean, iframe_selector: string, element_css_selector: string): Promise<boolean | string>;
14
8
  /**
15
9
  * Traverses up the DOM from the given locator to find the closest visible ancestor.
16
10
  * Returns a Locator for the first visible element found, or null if none is visible up to <html>.
@@ -99,17 +93,16 @@ declare class Highlighter {
99
93
  interface RunStepParams extends Partial<PlaywrightTimeoutConfig> {
100
94
  iframeSelector?: string;
101
95
  elementSelector?: string;
102
- action: PlaywrightAction | PlaywrightAction[] | string | string[];
96
+ action: PlaywrightAction;
103
97
  argument?: string | string[];
104
98
  annotation?: string;
105
- }
106
- interface RunStepResult {
107
- key: string;
108
- value: any;
99
+ pollingInterval?: number;
100
+ timeout?: number;
109
101
  }
110
102
  declare class ProboPlaywright {
111
103
  private readonly config;
112
104
  private page;
105
+ private lastNavigationTime;
113
106
  constructor(config?: PlaywrightTimeoutConfig, page?: Page$1 | null);
114
107
  /**
115
108
  * Sets the Playwright page instance for this ProboPlaywright instance.
@@ -118,6 +111,7 @@ declare class ProboPlaywright {
118
111
  * @param page - The Playwright Page instance to use, or null to unset.
119
112
  */
120
113
  setPage(page: Page$1 | null): void;
114
+ private onFrameNav;
121
115
  /**
122
116
  * Executes a single step in the test scenario with the specified action on the target element.
123
117
  * Handles iframe navigation, element highlighting, and various Playwright actions like click, fill, validate, etc.
@@ -126,7 +120,7 @@ declare class ProboPlaywright {
126
120
  * @returns Promise that resolves to a result object for extract actions, or void for other actions
127
121
  * @throws Error if element is not found or validation fails
128
122
  */
129
- runStep(params: RunStepParams): Promise<RunStepResult | void>;
123
+ runStep(params: RunStepParams): Promise<string | void>;
130
124
  /**
131
125
  * Creates a visual highlight overlay on the target element with optional annotation text.
132
126
  * The highlight appears as a red border around the element and can include descriptive text.
@@ -169,6 +163,78 @@ declare class ProboPlaywright {
169
163
  private getTextValue;
170
164
  }
171
165
 
166
+ interface NavTrackerOptions {
167
+ stabilizationTimeout?: number;
168
+ }
169
+ /**
170
+ * Global navigation tracker that monitors page navigation events
171
+ * and provides methods to check if navigation has stabilized
172
+ *
173
+ * This is a singleton class - only one instance can exist at a time
174
+ */
175
+ declare class NavTracker {
176
+ private static instance;
177
+ private page;
178
+ private navigationCount;
179
+ private lastNavTime;
180
+ private stabilizationTimeout;
181
+ private isListening;
182
+ private onFrameNavHandler;
183
+ private instanceId;
184
+ /**
185
+ * Private constructor - use getInstance() to get the singleton instance
186
+ */
187
+ private constructor();
188
+ /**
189
+ * Start listening for navigation events (private method)
190
+ */
191
+ private start;
192
+ /**
193
+ * Stop listening for navigation events (private method)
194
+ */
195
+ private stop;
196
+ /**
197
+ * Check if navigation has stabilized (no navigation for stabilizationTimeout ms) (private method)
198
+ */
199
+ private hasNavigationStabilized;
200
+ /**
201
+ * Wait for navigation to stabilize
202
+ * Waits a short time to catch any missed navigation events, then ensures
203
+ * the latest navigation happened at least stabilizationTimeout ms ago
204
+ */
205
+ waitForNavigationToStabilize(): Promise<void>;
206
+ /**
207
+ * Get the singleton instance of NavTracker
208
+ * @param page The page to track (required for first creation)
209
+ * @param options Optional configuration
210
+ * @returns The singleton NavTracker instance
211
+ */
212
+ static getInstance(page?: Page, options?: NavTrackerOptions): NavTracker;
213
+ }
214
+
215
+ /**
216
+ * Configuration options for Probo fixtures
217
+ */
218
+ interface ProboFixturesConfig {
219
+ /** The debug port where your recorder app's Chrome instance is running */
220
+ debugPort?: number;
221
+ /** Whether to show browser console logs */
222
+ showBrowserConsole?: boolean;
223
+ }
224
+ /**
225
+ * Creates Probo fixtures that connect to an existing Chrome instance
226
+ * instead of launching a new browser.
227
+ *
228
+ * @param config Configuration options for the fixtures
229
+ * @returns Extended test function with Probo fixtures
230
+ */
231
+ declare function createProboFixtures(config?: ProboFixturesConfig): _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
232
+ /**
233
+ * Default Probo fixtures with standard configuration
234
+ * Connects to Chrome instance running on port 9333
235
+ */
236
+ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
237
+
172
238
  /**
173
239
  * Configuration options for Probo client
174
240
  */
@@ -181,11 +247,13 @@ interface ProboConfig {
181
247
  logToFile?: boolean;
182
248
  debugLevel?: ProboLogLevel;
183
249
  aiModel?: AIModel;
250
+ timeoutConfig?: PlaywrightTimeoutConfig;
184
251
  }
185
252
  interface RunStepOptions {
186
253
  useCache: boolean;
187
254
  stepIdFromServer?: number | null;
188
255
  aiModel?: AIModel;
256
+ timeoutConfig?: PlaywrightTimeoutConfig;
189
257
  }
190
258
  declare class Probo {
191
259
  private highlighter;
@@ -193,12 +261,15 @@ declare class Probo {
193
261
  private readonly enableConsoleLogs;
194
262
  private readonly scenarioName;
195
263
  private readonly aiModel;
196
- constructor({ scenarioName, token, apiUrl, enableConsoleLogs, logToConsole, logToFile, debugLevel, aiModel }: ProboConfig);
264
+ private readonly timeoutConfig;
265
+ constructor({ scenarioName, token, apiUrl, enableConsoleLogs, logToConsole, logToFile, debugLevel, aiModel, timeoutConfig }: ProboConfig);
197
266
  askAI(page: Page, question: string): Promise<any>;
198
- runStep(page: Page, stepPrompt: string, argument?: string | boolean | null, options?: RunStepOptions): Promise<boolean | string>;
267
+ runStep(page: Page, stepPrompt: string, argument?: string | boolean | null, options?: RunStepOptions): Promise<boolean | string | null>;
199
268
  private _handleCachedStep;
200
269
  private _handleStepCreation;
201
270
  private setupConsoleLogs;
271
+ getInitialPageState(page: Page): Promise<InitialPageState>;
272
+ findAndHighlightCandidateElements(page: Page, elementTags: string[]): Promise<FindCandidateInput>;
202
273
  highlightElements(page: Page, elementTags: [ElementTagType]): Promise<any>;
203
274
  unhighlightElements(page: Page): Promise<void>;
204
275
  highlightElement(page: Page, element_css_selector: string, iframe_selector: string, element_index: string): Promise<void>;
@@ -208,5 +279,5 @@ declare class Probo {
208
279
  askAIHelper(page: Page, question: string): Promise<ServerResponse>;
209
280
  }
210
281
 
211
- export { Highlighter, Probo, ProboPlaywright, executeCachedPlaywrightAction, executePlaywrightAction, findClosestVisibleElement };
212
- export type { ElementTagType, RunStepOptions };
282
+ export { Highlighter, NavTracker, Probo, ProboPlaywright, createProboFixtures, findClosestVisibleElement, test };
283
+ export type { ElementTagType, ProboFixturesConfig, RunStepOptions };