@allwright.dev/core 0.1.13 → 0.1.15
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 +17 -0
- package/dist/bootstrap.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/locator.d.ts +7 -1
- package/dist/locator.js +18 -0
- package/dist/page.d.ts +8 -1
- package/dist/page.js +78 -7
- package/dist/types.d.ts +74 -1
- package/package.json +1 -1
- package/proto/core/v1/context.proto +43 -0
- package/proto/surfaces/web/v1/web.proto +17 -0
package/README.md
CHANGED
|
@@ -95,3 +95,20 @@ resolving its browsing context, and waiting for a fully loaded document with 200
|
|
|
95
95
|
without DOM mutations. The default is 10 seconds. Closing the frame page releases
|
|
96
96
|
its session; it does not remove the iframe or close the parent tab. Resolve a new
|
|
97
97
|
frame page after the iframe is replaced.
|
|
98
|
+
|
|
99
|
+
### Read page and element state
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
const url = await page.url();
|
|
103
|
+
const value = await page.locator('input, textarea').inputValue();
|
|
104
|
+
const options = await page.locator('select').selectedOptions(); // [{ value, label, index }]
|
|
105
|
+
const selectedText = await page.locator('textarea').selectedText();
|
|
106
|
+
const checked = await page.locator('input[type=checkbox]').isChecked();
|
|
107
|
+
const text = await page.locator('h1').innerText(); // { selector, text, note }
|
|
108
|
+
const attribute = await page.locator('a').getAttribute('href');
|
|
109
|
+
const box = await page.locator('button').boundingBox(); // { x, y, width, height }
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Element reads also have page methods such as `page.inputValue(selector, options)` and accept `timeoutMs`. Reads use the first locator match and work in frame pages. `inputValue` reads the live property of an input, textarea, or select. `selectedOptions` supports native selects (including multiple selections) and ARIA combobox/listbox options marked `aria-selected="true"`. `selectedText` returns the textbox's selected substring, an empty string for a caret, or `null` for input types without selection support. `isChecked` supports native checkbox/radio and ARIA checked controls; ARIA mixed state returns false.
|
|
113
|
+
|
|
114
|
+
Missing attributes return `null` (an empty attribute remains `""`). Bounding boxes use CSS pixels relative to the page/frame viewport and return `null` for hidden or zero-area elements. Missing elements and incompatible control types raise errors. Use `textContent()` for raw text or `innerText()` for rendered text.
|
package/dist/bootstrap.js
CHANGED
|
@@ -12,7 +12,7 @@ const ALLWRIGHT_HOME_ENV_VAR = "ALLWRIGHT_HOME";
|
|
|
12
12
|
const ALLWRIGHT_REPOSITORY_ENV_VAR = "ALLWRIGHT_REPOSITORY";
|
|
13
13
|
const ALLWRIGHT_VERSION_ENV_VAR = "ALLWRIGHT_VERSION";
|
|
14
14
|
const DEFAULT_RELEASE_REPOSITORY = "allwright-dev/allwright";
|
|
15
|
-
const DEFAULT_RELEASE_VERSION = "0.1.
|
|
15
|
+
const DEFAULT_RELEASE_VERSION = "0.1.15";
|
|
16
16
|
const STARTUP_TIMEOUT_MS = 20_000;
|
|
17
17
|
const PING_TIMEOUT_MS = 1_000;
|
|
18
18
|
const PROTO_ROOT = fileURLToPath(new URL("../proto/", import.meta.url));
|
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { findConfigFile, loadConfigFile, resolveConfig } from "./config.js";
|
|
|
3
3
|
import { mobile } from "./mobile.js";
|
|
4
4
|
import { PageImpl } from "./page.js";
|
|
5
5
|
import { setServerAddr, shutdown } from "./runtime.js";
|
|
6
|
-
import type { Browser, BrowserKind, BrowserType, LaunchOptions, Page, FileChooser, Download, HookType, ResolveConfigOptions, ResolvedAllwrightConfig } from "./types.js";
|
|
6
|
+
import type { Browser, BrowserKind, BrowserType, LaunchOptions, Page, Dialog, FileChooser, Download, HookType, ResolveConfigOptions, ResolvedAllwrightConfig } from "./types.js";
|
|
7
7
|
export { findConfigFile, loadConfigFile, resolveConfig, setServerAddr, shutdown };
|
|
8
|
-
export type { AccessibilitySnapshotOptions, AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, Hook, HookType, FileChooser, Download, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, LaunchOptions, MobileAndroidConnectOptions, MobileAndroidDevice, MobileAndroidLaunchOptions, MobileAndroidLocator, MobileAndroidApp, Locator, LocatorInfo, MobileSurfaceNamespace, NavigateResult, Page, PageInfo, PressOptions, PressResult, ResolveConfigOptions, ResolvedAllwrightConfig, RetryConfig, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
|
|
8
|
+
export type { CapturedOption, BoundingBox, AccessibilitySnapshotOptions, AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, Hook, HookType, Dialog, FileChooser, Download, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, LaunchOptions, MobileAndroidConnectOptions, MobileAndroidDevice, MobileAndroidLaunchOptions, MobileAndroidLocator, MobileAndroidApp, Locator, LocatorInfo, MobileSurfaceNamespace, NavigateResult, Page, PageInfo, PressOptions, PressResult, ResolveConfigOptions, ResolvedAllwrightConfig, RetryConfig, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
|
|
9
9
|
export declare const chromium: BrowserType;
|
|
10
10
|
export declare const firefox: BrowserType;
|
|
11
11
|
export declare const hooks: {
|
|
12
|
+
dialog: HookType<Dialog>;
|
|
12
13
|
newPage: HookType<Page>;
|
|
13
14
|
fileChooser: HookType<FileChooser>;
|
|
14
15
|
download: HookType<Download>;
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { findConfigFile, loadConfigFile, resolveConfig, setServerAddr, shutdown
|
|
|
8
8
|
export const chromium = new BrowserTypeImpl("chromium");
|
|
9
9
|
export const firefox = new BrowserTypeImpl("firefox");
|
|
10
10
|
export const hooks = {
|
|
11
|
+
dialog: Object.freeze({ name: "dialog" }),
|
|
11
12
|
newPage: Object.freeze({ name: "newPage" }),
|
|
12
13
|
fileChooser: Object.freeze({ name: "fileChooser" }),
|
|
13
14
|
download: Object.freeze({ name: "download" }),
|
package/dist/locator.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebLocatorBuilders, type LocatorFilterOptions } from "./web-locators.js";
|
|
2
|
-
import type { ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, Locator, LocatorInfo, Page, PressOptions, PressResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
|
|
2
|
+
import type { BoundingBox, CapturedOption, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, Locator, LocatorInfo, Page, PressOptions, PressResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
|
|
3
3
|
export declare class LocatorImpl extends WebLocatorBuilders implements Locator {
|
|
4
4
|
readonly page: Page;
|
|
5
5
|
readonly selector: string;
|
|
@@ -13,6 +13,12 @@ export declare class LocatorImpl extends WebLocatorBuilders implements Locator {
|
|
|
13
13
|
fill(value: string, options?: CommandOptions): Promise<FillResult>;
|
|
14
14
|
hover(options?: CommandOptions): Promise<ElementResult>;
|
|
15
15
|
press(key: string, options?: PressOptions): Promise<PressResult>;
|
|
16
|
+
inputValue(options?: CommandOptions): Promise<string>;
|
|
17
|
+
selectedOptions(options?: CommandOptions): Promise<CapturedOption[]>;
|
|
18
|
+
selectedText(options?: CommandOptions): Promise<string | null>;
|
|
19
|
+
isChecked(options?: CommandOptions): Promise<boolean>;
|
|
20
|
+
getAttribute(name: string, options?: CommandOptions): Promise<string | null>;
|
|
21
|
+
boundingBox(options?: CommandOptions): Promise<BoundingBox | null>;
|
|
16
22
|
textContent(options?: CommandOptions): Promise<TextResult>;
|
|
17
23
|
innerText(options?: CommandOptions): Promise<TextResult>;
|
|
18
24
|
waitFor(options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
|
package/dist/locator.js
CHANGED
|
@@ -31,6 +31,24 @@ export class LocatorImpl extends WebLocatorBuilders {
|
|
|
31
31
|
async press(key, options = {}) {
|
|
32
32
|
return this.page.press(this.selector, key, options);
|
|
33
33
|
}
|
|
34
|
+
async inputValue(options = {}) {
|
|
35
|
+
return this.page.inputValue(this.selector, options);
|
|
36
|
+
}
|
|
37
|
+
async selectedOptions(options = {}) {
|
|
38
|
+
return this.page.selectedOptions(this.selector, options);
|
|
39
|
+
}
|
|
40
|
+
async selectedText(options = {}) {
|
|
41
|
+
return this.page.selectedText(this.selector, options);
|
|
42
|
+
}
|
|
43
|
+
async isChecked(options = {}) {
|
|
44
|
+
return this.page.isChecked(this.selector, options);
|
|
45
|
+
}
|
|
46
|
+
async getAttribute(name, options = {}) {
|
|
47
|
+
return this.page.getAttribute(this.selector, name, options);
|
|
48
|
+
}
|
|
49
|
+
async boundingBox(options = {}) {
|
|
50
|
+
return this.page.boundingBox(this.selector, options);
|
|
51
|
+
}
|
|
34
52
|
async textContent(options = {}) {
|
|
35
53
|
return this.page.textContent(this.selector, options);
|
|
36
54
|
}
|
package/dist/page.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebLocatorBuilders, type LocatorFilterOptions } from "./web-locators.js";
|
|
2
|
-
import type { AccessibilitySnapshotOptions, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, FileChooser, Download, HighlightOptions, HighlightResult, Hook, HookType, Locator, NavigateResult, Page, PageInfo, PressOptions, PressResult, RuntimeClient, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
|
|
2
|
+
import type { BoundingBox, CapturedOption, AccessibilitySnapshotOptions, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, FileChooser, Download, HighlightOptions, HighlightResult, Hook, HookType, Locator, NavigateResult, Page, PageInfo, PressOptions, PressResult, RuntimeClient, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
|
|
3
3
|
export declare class PageImpl extends WebLocatorBuilders implements Page {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(input: PageInfo & {
|
|
@@ -21,6 +21,13 @@ export declare class PageImpl extends WebLocatorBuilders implements Page {
|
|
|
21
21
|
fill(selector: string, value: string, options?: CommandOptions): Promise<FillResult>;
|
|
22
22
|
hover(selector: string, options?: CommandOptions): Promise<ElementResult>;
|
|
23
23
|
press(selector: string, key: string, options?: PressOptions): Promise<PressResult>;
|
|
24
|
+
url(options?: CommandOptions): Promise<string>;
|
|
25
|
+
inputValue(selector: string, options?: CommandOptions): Promise<string>;
|
|
26
|
+
selectedOptions(selector: string, options?: CommandOptions): Promise<CapturedOption[]>;
|
|
27
|
+
selectedText(selector: string, options?: CommandOptions): Promise<string | null>;
|
|
28
|
+
isChecked(selector: string, options?: CommandOptions): Promise<boolean>;
|
|
29
|
+
getAttribute(selector: string, name: string, options?: CommandOptions): Promise<string | null>;
|
|
30
|
+
boundingBox(selector: string, options?: CommandOptions): Promise<BoundingBox | null>;
|
|
24
31
|
textContent(selector: string, options?: CommandOptions): Promise<TextResult>;
|
|
25
32
|
innerText(selector: string, options?: CommandOptions): Promise<TextResult>;
|
|
26
33
|
waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
|
package/dist/page.js
CHANGED
|
@@ -42,7 +42,7 @@ export class PageImpl extends WebLocatorBuilders {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
async registerHook(type) {
|
|
45
|
-
if (type.name !== "newPage" && type.name !== "fileChooser" && type.name !== "download") {
|
|
45
|
+
if (type.name !== "dialog" && type.name !== "newPage" && type.name !== "fileChooser" && type.name !== "download") {
|
|
46
46
|
throw formatActionError("register hook", `unsupported hook type: ${type.name}`);
|
|
47
47
|
}
|
|
48
48
|
const handle = await this.#getHandle();
|
|
@@ -50,11 +50,8 @@ export class PageImpl extends WebLocatorBuilders {
|
|
|
50
50
|
handle.stream.write({
|
|
51
51
|
surfaceSessionId: this.browserSessionId,
|
|
52
52
|
contextSessionId: this.sessionId,
|
|
53
|
-
registerHook: type.name === "newPage"
|
|
54
|
-
? { newPage: {} }
|
|
55
|
-
: type.name === "fileChooser"
|
|
56
|
-
? { fileChooser: {} }
|
|
57
|
-
: { download: {} },
|
|
53
|
+
registerHook: type.name === "dialog" ? { dialog: {} } : type.name === "newPage"
|
|
54
|
+
? { newPage: {} } : type.name === "fileChooser" ? { fileChooser: {} } : { download: {} },
|
|
58
55
|
});
|
|
59
56
|
while (true) {
|
|
60
57
|
const event = await handle.queue.next();
|
|
@@ -79,12 +76,21 @@ export class PageImpl extends WebLocatorBuilders {
|
|
|
79
76
|
contextSessionId: this.sessionId,
|
|
80
77
|
waitForHook: {
|
|
81
78
|
hookId,
|
|
82
|
-
retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
|
|
79
|
+
retryOptions: options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : undefined,
|
|
83
80
|
},
|
|
84
81
|
});
|
|
85
82
|
while (true) {
|
|
86
83
|
const event = await handle.queue.next();
|
|
87
84
|
if (event.hookCompleted?.hookId === hookId) {
|
|
85
|
+
if (type.name === "dialog" && event.hookCompleted.dialog?.dialogId) {
|
|
86
|
+
const result = event.hookCompleted.dialog;
|
|
87
|
+
const id = result.dialogId;
|
|
88
|
+
return {
|
|
89
|
+
id, page: this, type: result.type ?? "", message: result.message ?? "", defaultValue: result.defaultValue ?? "",
|
|
90
|
+
accept: (promptText, options = {}) => this.#handleDialog(id, true, promptText, options),
|
|
91
|
+
dismiss: (options = {}) => this.#handleDialog(id, false, undefined, options),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
88
94
|
if (type.name === "newPage" && event.hookCompleted.newPage?.contextSessionId) {
|
|
89
95
|
return this.#createPage(event.hookCompleted.newPage.contextSessionId);
|
|
90
96
|
}
|
|
@@ -101,6 +107,25 @@ export class PageImpl extends WebLocatorBuilders {
|
|
|
101
107
|
}
|
|
102
108
|
}
|
|
103
109
|
}
|
|
110
|
+
async #handleDialog(dialogId, accept, promptText, options) {
|
|
111
|
+
const handle = await this.#getHandle();
|
|
112
|
+
this.#ensureOpen(handle);
|
|
113
|
+
handle.stream.write({ surfaceSessionId: this.browserSessionId, contextSessionId: this.sessionId,
|
|
114
|
+
handleDialog: { dialogId, accept, promptText,
|
|
115
|
+
...(options.timeoutMs !== undefined ? { retryOptions: { timeoutMs: options.timeoutMs } } : {}),
|
|
116
|
+
} });
|
|
117
|
+
while (true) {
|
|
118
|
+
const event = await handle.queue.next();
|
|
119
|
+
if (event.dialogHandled?.dialogId === dialogId)
|
|
120
|
+
return;
|
|
121
|
+
if (event.error?.message)
|
|
122
|
+
throw formatActionError("handle dialog", event.error.message);
|
|
123
|
+
if (event.closed) {
|
|
124
|
+
handle.closed = true;
|
|
125
|
+
throw new Error("page closed while handling dialog");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
104
129
|
async setFileChooserFiles(fileChooserId, files, options = {}) {
|
|
105
130
|
const handle = await this.#getHandle();
|
|
106
131
|
this.#ensureOpen(handle);
|
|
@@ -476,6 +501,52 @@ export class PageImpl extends WebLocatorBuilders {
|
|
|
476
501
|
}
|
|
477
502
|
}
|
|
478
503
|
}
|
|
504
|
+
async #capture(kind, selector, attributeName, options) {
|
|
505
|
+
const handle = await this.#getHandle();
|
|
506
|
+
this.#ensureOpen(handle);
|
|
507
|
+
handle.stream.write({ surfaceSessionId: this.browserSessionId, contextSessionId: this.sessionId,
|
|
508
|
+
capture: { kind, cssSelector: selector ? normalizeSelectorForTransport(selector) : "", attributeName,
|
|
509
|
+
retryOptions: options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : undefined } });
|
|
510
|
+
while (true) {
|
|
511
|
+
const event = await handle.queue.next();
|
|
512
|
+
if (event.captureResolved)
|
|
513
|
+
return event.captureResolved;
|
|
514
|
+
if (event.error)
|
|
515
|
+
throw formatActionError("capture", event.error.message ?? "capture failed", selector);
|
|
516
|
+
if (event.closed) {
|
|
517
|
+
handle.closed = true;
|
|
518
|
+
throw new Error("page session closed while capturing");
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
async url(options = {}) {
|
|
523
|
+
const r = await this.#capture("CAPTURE_KIND_URL", "", "", options);
|
|
524
|
+
return r.value ?? "";
|
|
525
|
+
}
|
|
526
|
+
async inputValue(selector, options = {}) {
|
|
527
|
+
const r = await this.#capture("CAPTURE_KIND_INPUT_VALUE", selector, "", options);
|
|
528
|
+
return r.value ?? "";
|
|
529
|
+
}
|
|
530
|
+
async selectedOptions(selector, options = {}) {
|
|
531
|
+
const r = await this.#capture("CAPTURE_KIND_SELECTED_OPTIONS", selector, "", options);
|
|
532
|
+
return r.selectedOptions ?? [];
|
|
533
|
+
}
|
|
534
|
+
async selectedText(selector, options = {}) {
|
|
535
|
+
const r = await this.#capture("CAPTURE_KIND_SELECTED_TEXT", selector, "", options);
|
|
536
|
+
return r.value ?? null;
|
|
537
|
+
}
|
|
538
|
+
async isChecked(selector, options = {}) {
|
|
539
|
+
const r = await this.#capture("CAPTURE_KIND_CHECKED", selector, "", options);
|
|
540
|
+
return r.checked ?? false;
|
|
541
|
+
}
|
|
542
|
+
async getAttribute(selector, name, options = {}) {
|
|
543
|
+
const r = await this.#capture("CAPTURE_KIND_ATTRIBUTE", selector, name, options);
|
|
544
|
+
return r.value ?? null;
|
|
545
|
+
}
|
|
546
|
+
async boundingBox(selector, options = {}) {
|
|
547
|
+
const r = await this.#capture("CAPTURE_KIND_BOUNDING_BOX", selector, "", options);
|
|
548
|
+
return r.boundingBox ?? null;
|
|
549
|
+
}
|
|
479
550
|
async textContent(selector, options = {}) {
|
|
480
551
|
return this.#readText(selector, options, true);
|
|
481
552
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -108,6 +108,15 @@ export interface Hook<T> {
|
|
|
108
108
|
readonly type: HookType<T>;
|
|
109
109
|
wait(options?: CommandOptions): Promise<T>;
|
|
110
110
|
}
|
|
111
|
+
export interface Dialog {
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly page: Page;
|
|
114
|
+
readonly type: string;
|
|
115
|
+
readonly message: string;
|
|
116
|
+
readonly defaultValue: string;
|
|
117
|
+
accept(promptText?: string, options?: CommandOptions): Promise<void>;
|
|
118
|
+
dismiss(options?: CommandOptions): Promise<void>;
|
|
119
|
+
}
|
|
111
120
|
export interface FileChooser {
|
|
112
121
|
readonly id: string;
|
|
113
122
|
readonly page: Page | MobileAndroidApp;
|
|
@@ -133,6 +142,13 @@ export interface Browser extends BrowserInfo {
|
|
|
133
142
|
browserInfo(): BrowserInfo;
|
|
134
143
|
}
|
|
135
144
|
export interface Page extends PageInfo, WebLocators {
|
|
145
|
+
url(options?: CommandOptions): Promise<string>;
|
|
146
|
+
inputValue(selector: string, options?: CommandOptions): Promise<string>;
|
|
147
|
+
selectedOptions(selector: string, options?: CommandOptions): Promise<CapturedOption[]>;
|
|
148
|
+
selectedText(selector: string, options?: CommandOptions): Promise<string | null>;
|
|
149
|
+
isChecked(selector: string, options?: CommandOptions): Promise<boolean>;
|
|
150
|
+
getAttribute(selector: string, name: string, options?: CommandOptions): Promise<string | null>;
|
|
151
|
+
boundingBox(selector: string, options?: CommandOptions): Promise<BoundingBox | null>;
|
|
136
152
|
frame(selector: string, options?: CommandOptions): Promise<Page>;
|
|
137
153
|
registerHook<T>(type: HookType<T>): Promise<Hook<T>>;
|
|
138
154
|
accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
|
|
@@ -207,6 +223,12 @@ export interface MobileSurfaceNamespace {
|
|
|
207
223
|
};
|
|
208
224
|
}
|
|
209
225
|
export interface Locator extends WebLocators {
|
|
226
|
+
inputValue(options?: CommandOptions): Promise<string>;
|
|
227
|
+
selectedOptions(options?: CommandOptions): Promise<CapturedOption[]>;
|
|
228
|
+
selectedText(options?: CommandOptions): Promise<string | null>;
|
|
229
|
+
isChecked(options?: CommandOptions): Promise<boolean>;
|
|
230
|
+
getAttribute(name: string, options?: CommandOptions): Promise<string | null>;
|
|
231
|
+
boundingBox(options?: CommandOptions): Promise<BoundingBox | null>;
|
|
210
232
|
frame(options?: CommandOptions): Promise<Page>;
|
|
211
233
|
Frame(options?: CommandOptions): Promise<Page>;
|
|
212
234
|
not(other: Locator): Locator;
|
|
@@ -377,6 +399,7 @@ export interface SurfaceSessionEvent {
|
|
|
377
399
|
};
|
|
378
400
|
}
|
|
379
401
|
export interface ContextSessionEvent {
|
|
402
|
+
captureResolved?: CaptureResult;
|
|
380
403
|
frameResolved?: {
|
|
381
404
|
contextSessionId?: string;
|
|
382
405
|
};
|
|
@@ -401,8 +424,17 @@ export interface ContextSessionEvent {
|
|
|
401
424
|
hookRegistered?: {
|
|
402
425
|
hookId?: string;
|
|
403
426
|
};
|
|
427
|
+
dialogHandled?: {
|
|
428
|
+
dialogId?: string;
|
|
429
|
+
};
|
|
404
430
|
hookCompleted?: {
|
|
405
431
|
hookId?: string;
|
|
432
|
+
dialog?: {
|
|
433
|
+
dialogId?: string;
|
|
434
|
+
type?: string;
|
|
435
|
+
message?: string;
|
|
436
|
+
defaultValue?: string;
|
|
437
|
+
};
|
|
406
438
|
newPage?: {
|
|
407
439
|
contextSessionId?: string;
|
|
408
440
|
note?: string;
|
|
@@ -553,10 +585,23 @@ export interface OpenContextRequest {
|
|
|
553
585
|
};
|
|
554
586
|
};
|
|
555
587
|
}
|
|
588
|
+
export interface HandleDialogRequest {
|
|
589
|
+
surfaceSessionId: string;
|
|
590
|
+
contextSessionId: string;
|
|
591
|
+
handleDialog: {
|
|
592
|
+
dialogId: string;
|
|
593
|
+
accept: boolean;
|
|
594
|
+
promptText?: string;
|
|
595
|
+
retryOptions?: {
|
|
596
|
+
timeoutMs?: number;
|
|
597
|
+
};
|
|
598
|
+
};
|
|
599
|
+
}
|
|
556
600
|
export interface RegisterHookRequest {
|
|
557
601
|
surfaceSessionId: string;
|
|
558
602
|
contextSessionId: string;
|
|
559
603
|
registerHook: {
|
|
604
|
+
dialog?: Record<string, never>;
|
|
560
605
|
newPage?: Record<string, never>;
|
|
561
606
|
fileChooser?: Record<string, never>;
|
|
562
607
|
download?: Record<string, never>;
|
|
@@ -816,6 +861,17 @@ export interface CloseContextRequest {
|
|
|
816
861
|
}
|
|
817
862
|
export type SurfaceSessionRequest = LaunchBrowserRequest | LaunchChromeRequest | OpenContextRequest | ConnectMobileRequest | LaunchAppRequest | SurfacePingRequest | CloseSurfaceRequest;
|
|
818
863
|
export type ContextSessionRequest = {
|
|
864
|
+
surfaceSessionId: string;
|
|
865
|
+
contextSessionId: string;
|
|
866
|
+
capture: {
|
|
867
|
+
kind: string;
|
|
868
|
+
cssSelector: string;
|
|
869
|
+
attributeName: string;
|
|
870
|
+
retryOptions?: {
|
|
871
|
+
timeoutMs: number;
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
} | {
|
|
819
875
|
surfaceSessionId: string;
|
|
820
876
|
contextSessionId: string;
|
|
821
877
|
resolveFrame: {
|
|
@@ -824,7 +880,7 @@ export type ContextSessionRequest = {
|
|
|
824
880
|
timeoutMs: number;
|
|
825
881
|
};
|
|
826
882
|
};
|
|
827
|
-
} | ContextPingRequest | RegisterHookRequest | WaitForHookRequest | SetFileChooserFilesRequest | SaveDownloadRequest | UploadFileChunkRequest | ReadFileChunkRequest | SetMobileFileChooserFilesRequest | SaveMobileDownloadRequest | NavigateRequest | ClickRequest | CountRequest | HighlightRequest | FocusRequest | FillRequest | HoverRequest | PressRequest | TextContentRequest | InnerTextRequest | WaitForSelectorRequest | AccessibilitySnapshotRequest | ScreenshotRequest | CloseContextRequest;
|
|
883
|
+
} | ContextPingRequest | RegisterHookRequest | WaitForHookRequest | HandleDialogRequest | SetFileChooserFilesRequest | SaveDownloadRequest | UploadFileChunkRequest | ReadFileChunkRequest | SetMobileFileChooserFilesRequest | SaveMobileDownloadRequest | NavigateRequest | ClickRequest | CountRequest | HighlightRequest | FocusRequest | FillRequest | HoverRequest | PressRequest | TextContentRequest | InnerTextRequest | WaitForSelectorRequest | AccessibilitySnapshotRequest | ScreenshotRequest | CloseContextRequest;
|
|
828
884
|
export type SurfaceSessionStream = grpc.ClientDuplexStream<SurfaceSessionRequest, SurfaceSessionEvent>;
|
|
829
885
|
export type ContextSessionStream = grpc.ClientDuplexStream<ContextSessionRequest, ContextSessionEvent>;
|
|
830
886
|
export interface EngineServiceClientShape {
|
|
@@ -866,3 +922,20 @@ export declare class EventQueue<T> {
|
|
|
866
922
|
fail(error: Error): void;
|
|
867
923
|
next(): Promise<T>;
|
|
868
924
|
}
|
|
925
|
+
export interface CapturedOption {
|
|
926
|
+
value: string;
|
|
927
|
+
label: string;
|
|
928
|
+
index: number;
|
|
929
|
+
}
|
|
930
|
+
export interface BoundingBox {
|
|
931
|
+
x: number;
|
|
932
|
+
y: number;
|
|
933
|
+
width: number;
|
|
934
|
+
height: number;
|
|
935
|
+
}
|
|
936
|
+
export interface CaptureResult {
|
|
937
|
+
value?: string;
|
|
938
|
+
checked?: boolean;
|
|
939
|
+
selectedOptions?: CapturedOption[];
|
|
940
|
+
boundingBox?: BoundingBox;
|
|
941
|
+
}
|
package/package.json
CHANGED
|
@@ -38,6 +38,8 @@ message ContextSessionCommand {
|
|
|
38
38
|
SetMobileFileChooserFilesCommand set_mobile_file_chooser_files = 24;
|
|
39
39
|
SaveMobileDownloadCommand save_mobile_download = 25;
|
|
40
40
|
ResolveFrameCommand resolve_frame = 26;
|
|
41
|
+
CaptureCommand capture = 27;
|
|
42
|
+
HandleDialogCommand handle_dialog = 28;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -78,6 +80,8 @@ message ContextSessionEvent {
|
|
|
78
80
|
MobileFileChooserFilesSetEvent mobile_file_chooser_files_set = 26;
|
|
79
81
|
MobileDownloadSavedEvent mobile_download_saved = 27;
|
|
80
82
|
FrameResolvedEvent frame_resolved = 28;
|
|
83
|
+
CaptureResolvedEvent capture_resolved = 29;
|
|
84
|
+
DialogHandledEvent dialog_handled = 30;
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
87
|
|
|
@@ -104,6 +108,7 @@ message RegisterHookCommand {
|
|
|
104
108
|
RegisterDownloadHook download = 3;
|
|
105
109
|
RegisterMobileFileChooserHook mobile_file_chooser = 4;
|
|
106
110
|
RegisterMobileDownloadHook mobile_download = 5;
|
|
111
|
+
RegisterDialogHook dialog = 6;
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
|
|
@@ -125,6 +130,7 @@ message HookCompletedEvent {
|
|
|
125
130
|
DownloadHookResult download = 4;
|
|
126
131
|
MobileFileChooserHookResult mobile_file_chooser = 5;
|
|
127
132
|
MobileDownloadHookResult mobile_download = 6;
|
|
133
|
+
DialogHookResult dialog = 7;
|
|
128
134
|
}
|
|
129
135
|
}
|
|
130
136
|
|
|
@@ -311,3 +317,40 @@ message AccessibilitySnapshotCapturedEvent {
|
|
|
311
317
|
string snapshot = 1;
|
|
312
318
|
string format = 2;
|
|
313
319
|
}
|
|
320
|
+
|
|
321
|
+
// Read-only web inspection. Element reads use the first locator match.
|
|
322
|
+
enum CaptureKind {
|
|
323
|
+
CAPTURE_KIND_UNSPECIFIED = 0;
|
|
324
|
+
CAPTURE_KIND_URL = 1;
|
|
325
|
+
CAPTURE_KIND_INPUT_VALUE = 2;
|
|
326
|
+
CAPTURE_KIND_SELECTED_OPTIONS = 3;
|
|
327
|
+
CAPTURE_KIND_SELECTED_TEXT = 4;
|
|
328
|
+
CAPTURE_KIND_CHECKED = 5;
|
|
329
|
+
CAPTURE_KIND_ATTRIBUTE = 6;
|
|
330
|
+
CAPTURE_KIND_BOUNDING_BOX = 7;
|
|
331
|
+
}
|
|
332
|
+
message CaptureCommand {
|
|
333
|
+
CaptureKind kind = 1;
|
|
334
|
+
string css_selector = 2;
|
|
335
|
+
string attribute_name = 3;
|
|
336
|
+
optional CommandRetryOptions retry_options = 4;
|
|
337
|
+
}
|
|
338
|
+
message CapturedOption {
|
|
339
|
+
string value = 1;
|
|
340
|
+
string label = 2;
|
|
341
|
+
uint32 index = 3;
|
|
342
|
+
}
|
|
343
|
+
message BoundingBox {
|
|
344
|
+
double x = 1;
|
|
345
|
+
double y = 2;
|
|
346
|
+
double width = 3;
|
|
347
|
+
double height = 4;
|
|
348
|
+
}
|
|
349
|
+
message CaptureResolvedEvent {
|
|
350
|
+
// Absent for a missing attribute or unsupported text selection.
|
|
351
|
+
optional string value = 1;
|
|
352
|
+
optional bool checked = 2;
|
|
353
|
+
repeated CapturedOption selected_options = 3;
|
|
354
|
+
// Viewport coordinates in CSS pixels, absent for an element without a visible box.
|
|
355
|
+
optional BoundingBox bounding_box = 4;
|
|
356
|
+
}
|
|
@@ -40,6 +40,23 @@ message ChromeLaunchedEvent {
|
|
|
40
40
|
string initial_page_session_id = 5;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Register before the triggering action; wait returns a pending JavaScript dialog.
|
|
44
|
+
message RegisterDialogHook {}
|
|
45
|
+
message DialogHookResult {
|
|
46
|
+
string dialog_id = 1;
|
|
47
|
+
string type = 2;
|
|
48
|
+
string message = 3;
|
|
49
|
+
string default_value = 4;
|
|
50
|
+
}
|
|
51
|
+
message HandleDialogCommand {
|
|
52
|
+
string dialog_id = 1;
|
|
53
|
+
bool accept = 2;
|
|
54
|
+
optional string prompt_text = 3;
|
|
55
|
+
// A single-attempt deadline, not a retry request.
|
|
56
|
+
optional CommandRetryOptions retry_options = 4;
|
|
57
|
+
}
|
|
58
|
+
message DialogHandledEvent { string dialog_id = 1; }
|
|
59
|
+
|
|
43
60
|
message RegisterNewPageHook {}
|
|
44
61
|
|
|
45
62
|
message NewPageHookResult {
|