@probolabs/playwright 0.4.17 → 0.4.19
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/index.d.ts +56 -60
- package/dist/index.js +1238 -1024
- package/dist/index.js.map +1 -1
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/highlight.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/probo-logger.d.ts.map +1 -0
- package/package.json +5 -4
- package/dist/types/api-client.d.ts.map +0 -1
- package/dist/types/utils.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
import { Page } from 'playwright';
|
|
2
|
-
import { ElementTag } from '@probolabs/
|
|
3
|
-
export { ElementInfo, ElementTag } from '@probolabs/
|
|
2
|
+
import { PlaywrightAction, ElementTag, ProboLogLevel } from '@probolabs/probo-shared';
|
|
3
|
+
export { ElementInfo, ElementTag, PlaywrightAction, ProboLogLevel } from '@probolabs/probo-shared';
|
|
4
4
|
|
|
5
|
-
declare const PlaywrightAction: {
|
|
6
|
-
readonly VISIT_BASE_URL: "VISIT_BASE_URL";
|
|
7
|
-
readonly VISIT_URL: "VISIT_URL";
|
|
8
|
-
readonly CLICK: "CLICK";
|
|
9
|
-
readonly FILL_IN: "FILL_IN";
|
|
10
|
-
readonly SELECT_DROPDOWN: "SELECT_DROPDOWN";
|
|
11
|
-
readonly SELECT_MULTIPLE_DROPDOWN: "SELECT_MULTIPLE_DROPDOWN";
|
|
12
|
-
readonly CHECK_CHECKBOX: "CHECK_CHECKBOX";
|
|
13
|
-
readonly SELECT_RADIO: "SELECT_RADIO";
|
|
14
|
-
readonly TOGGLE_SWITCH: "TOGGLE_SWITCH";
|
|
15
|
-
readonly TYPE_KEYS: "TYPE_KEYS";
|
|
16
|
-
readonly HOVER: "HOVER";
|
|
17
|
-
readonly VALIDATE_EXACT_VALUE: "VALIDATE_EXACT_VALUE";
|
|
18
|
-
readonly VALIDATE_CONTAINS_VALUE: "VALIDATE_CONTAINS_VALUE";
|
|
19
|
-
readonly VALIDATE_URL: "VALIDATE_URL";
|
|
20
|
-
};
|
|
21
|
-
type PlaywrightActionType = typeof PlaywrightAction[keyof typeof PlaywrightAction];
|
|
22
5
|
/**
|
|
23
6
|
* Execute a given Playwright action, mirroring Python's _perform_action
|
|
24
7
|
*/
|
|
25
|
-
declare function executePlaywrightAction(page: Page, action:
|
|
8
|
+
declare function executePlaywrightAction(page: Page, action: PlaywrightAction, value: string, iframe_selector: string, element_css_selector: string): Promise<boolean>;
|
|
26
9
|
/**
|
|
27
10
|
* Execute a given Playwright action using native Playwright functions where possible
|
|
28
11
|
*/
|
|
29
|
-
declare function executeCachedPlaywrightAction(page: Page, action:
|
|
12
|
+
declare function executeCachedPlaywrightAction(page: Page, action: PlaywrightAction, value: string, iframe_selector: string, element_css_selector: string): Promise<boolean>;
|
|
30
13
|
|
|
31
14
|
type ElementTagType = typeof ElementTag[keyof typeof ElementTag];
|
|
32
15
|
declare global {
|
|
@@ -42,7 +25,22 @@ declare global {
|
|
|
42
25
|
iframe_selector: string;
|
|
43
26
|
index: string;
|
|
44
27
|
}>) => void;
|
|
28
|
+
unhighlightElements: () => void;
|
|
29
|
+
findElements: (elementTypes: string) => any[];
|
|
30
|
+
getElementInfo: (element: Element, index: number) => any;
|
|
45
31
|
ElementTag: typeof ElementTag;
|
|
32
|
+
candidates?: any[];
|
|
33
|
+
actual?: any;
|
|
34
|
+
matchingCandidate?: any;
|
|
35
|
+
findAndCacheCandidateElements?: (elementTypes: string[]) => number;
|
|
36
|
+
findAndCacheActualElement?: (cssSelector: string, iframeSelector: string | null, isHover: boolean) => boolean;
|
|
37
|
+
findAndCacheMatchingCandidate?: () => boolean;
|
|
38
|
+
highlightCachedElements?: (which: 'candidates' | 'actual' | 'matching') => void;
|
|
39
|
+
unhighlight?: () => void;
|
|
40
|
+
reset?: () => void;
|
|
41
|
+
getCandidates?: () => any[];
|
|
42
|
+
getActual?: () => any;
|
|
43
|
+
getMatchingCandidate?: () => any;
|
|
46
44
|
};
|
|
47
45
|
}
|
|
48
46
|
}
|
|
@@ -53,43 +51,40 @@ declare class Highlighter {
|
|
|
53
51
|
highlightElements(page: Page, elementTags: [ElementTagType]): Promise<any>;
|
|
54
52
|
unhighlightElements(page: Page): Promise<void>;
|
|
55
53
|
highlightElement(page: Page, element_css_selector: string, iframe_selector: string, element_index: string): Promise<void>;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
log(...args: any[]): void;
|
|
91
|
-
warn(...args: any[]): void;
|
|
92
|
-
error(...args: any[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Find and cache candidate elements of a given type (e.g., 'CLICKABLE').
|
|
56
|
+
* Returns the number of candidates found.
|
|
57
|
+
*/
|
|
58
|
+
findAndCacheCandidateElements(page: Page, elementTypes: string[]): Promise<number>;
|
|
59
|
+
/**
|
|
60
|
+
* Find and cache the actual interaction element by CSS and iframe selector.
|
|
61
|
+
* Returns true if found, false otherwise.
|
|
62
|
+
*/
|
|
63
|
+
findAndCacheActualElement(page: Page, cssSelector: string, iframeSelector: string | null, isHover?: boolean): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Find and cache the best matching candidate for the actual element.
|
|
66
|
+
* Returns true if a match was found, false otherwise.
|
|
67
|
+
*/
|
|
68
|
+
findAndCacheMatchingCandidate(page: Page): Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Highlight the cached candidates, actual, or matching candidate.
|
|
71
|
+
* @param which 'candidates' | 'actual' | 'matching'
|
|
72
|
+
*/
|
|
73
|
+
highlightCachedElements(page: Page, which: 'candidates' | 'actual' | 'matching'): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Remove all highlights.
|
|
76
|
+
*/
|
|
77
|
+
unhighlightCached(page: Page): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Reset/clear all cached state.
|
|
80
|
+
*/
|
|
81
|
+
resetCached(page: Page): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Get serializable info for Node/Playwright (candidates, actual, matchingCandidate)
|
|
84
|
+
*/
|
|
85
|
+
getCandidatesCached(page: Page): Promise<any[] | undefined>;
|
|
86
|
+
getActualCached(page: Page): Promise<any>;
|
|
87
|
+
getMatchingCandidateCached(page: Page): Promise<any>;
|
|
93
88
|
}
|
|
94
89
|
|
|
95
90
|
/**
|
|
@@ -133,7 +128,7 @@ declare class Probo {
|
|
|
133
128
|
private readonly scenarioName;
|
|
134
129
|
private readonly aiModel;
|
|
135
130
|
constructor({ scenarioName, token, apiUrl, enableConsoleLogs, logToConsole, logToFile, debugLevel, aiModel }: ProboConfig);
|
|
136
|
-
runStep(page: Page, stepPrompt: string, options?: RunStepOptions): Promise<boolean>;
|
|
131
|
+
runStep(page: Page, stepPrompt: string, argument?: string | null, options?: RunStepOptions): Promise<boolean>;
|
|
137
132
|
private _handleCachedStep;
|
|
138
133
|
private _handleStepCreation;
|
|
139
134
|
private setupConsoleLogs;
|
|
@@ -144,4 +139,5 @@ declare class Probo {
|
|
|
144
139
|
private _handlePerformAction;
|
|
145
140
|
}
|
|
146
141
|
|
|
147
|
-
export { AIModel,
|
|
142
|
+
export { AIModel, Highlighter, Probo, executeCachedPlaywrightAction, executePlaywrightAction };
|
|
143
|
+
export type { ElementTagType, RunStepOptions };
|