@allwright.dev/core 0.0.53 → 0.0.55

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/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.0.53";
15
+ const DEFAULT_RELEASE_VERSION = "0.0.55";
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/browser.js CHANGED
@@ -77,6 +77,9 @@ export class BrowserImpl {
77
77
  const event = await this.#queue.next();
78
78
  if (event.closed) {
79
79
  this.#closed = true;
80
+ for (const page of this.#pages.values()) {
81
+ page.dispose();
82
+ }
80
83
  this.#stream.end();
81
84
  return;
82
85
  }
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { PageImpl } from "./page.js";
5
5
  import { setServerAddr, shutdown } from "./runtime.js";
6
6
  import type { Browser, BrowserKind, BrowserType, LaunchOptions, Page, ResolveConfigOptions, ResolvedAllwrightConfig } from "./types.js";
7
7
  export { findConfigFile, loadConfigFile, resolveConfig, setServerAddr, shutdown };
8
- export type { AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, LaunchOptions, MobileAndroidConnectOptions, MobileAndroidDevice, MobileAndroidLaunchOptions, MobileAndroidLocator, MobileAndroidApp, Locator, LocatorInfo, MobileSurfaceNamespace, NavigateResult, Page, PageInfo, PressOptions, PressResult, ResolveConfigOptions, ResolvedAllwrightConfig, RetryConfig, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
8
+ export type { AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, 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 { mobile };
package/dist/mobile.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { createBrowserSessionHandle, createPageHandle, getRuntime } from "./runtime.js";
2
+ import { writeFile } from "node:fs/promises";
2
3
  import { chainMobileSelectorForTransport, normalizeMobileSelectorForTransport } from "./mobileSelectors.js";
3
4
  function retryOptions(timeoutMs) {
4
5
  return timeoutMs ? { timeoutMs } : undefined;
@@ -75,6 +76,38 @@ class MobileAndroidAppImpl {
75
76
  }
76
77
  }
77
78
  }
79
+ async screenshot(options = {}) {
80
+ const handle = await this.#getHandle();
81
+ this.#ensureOpen(handle);
82
+ handle.stream.write({
83
+ surfaceSessionId: this.#surfaceSessionId,
84
+ contextSessionId: this.sessionId,
85
+ screenshot: {
86
+ retryOptions: retryOptions(options.timeoutMs),
87
+ fullPage: options.fullPage,
88
+ },
89
+ });
90
+ while (true) {
91
+ const event = await handle.queue.next();
92
+ if (event.screenshotCaptured?.pngData) {
93
+ const screenshot = {
94
+ pngData: event.screenshotCaptured.pngData,
95
+ note: event.screenshotCaptured.note ?? "",
96
+ };
97
+ if (options.path) {
98
+ await writeFile(options.path, screenshot.pngData);
99
+ }
100
+ return screenshot;
101
+ }
102
+ if (event.error?.message) {
103
+ throw new Error(event.error.message);
104
+ }
105
+ if (event.closed) {
106
+ handle.closed = true;
107
+ throw new Error(`android app session ${this.sessionId} closed while capturing screenshot`);
108
+ }
109
+ }
110
+ }
78
111
  async #getHandle() {
79
112
  if (!this.#handlePromise) {
80
113
  this.#handlePromise = createPageHandle(this.#runtime);
package/dist/page.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, Locator, NavigateResult, Page, PageInfo, PressOptions, PressResult, RuntimeClient, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
1
+ import type { ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, Locator, NavigateResult, Page, PageInfo, PressOptions, PressResult, RuntimeClient, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
2
2
  export declare class PageImpl implements Page {
3
3
  #private;
4
4
  constructor(input: PageInfo & {
@@ -18,8 +18,10 @@ export declare class PageImpl implements Page {
18
18
  textContent(selector: string, options?: CommandOptions): Promise<TextResult>;
19
19
  innerText(selector: string, options?: CommandOptions): Promise<TextResult>;
20
20
  waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
21
+ screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
21
22
  close(): Promise<void>;
22
23
  ping(message?: string): Promise<string>;
23
24
  pageInfo(): PageInfo;
24
25
  navigate(url: string, options?: CommandOptions): Promise<NavigateResult>;
26
+ dispose(): void;
25
27
  }
package/dist/page.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { LocatorImpl } from "./locator.js";
2
+ import { writeFile } from "node:fs/promises";
2
3
  import { formatActionError } from "./errors.js";
3
4
  import { normalizeSelectorForTransport } from "./selectors.js";
4
5
  import { createPageHandle } from "./runtime.js";
@@ -304,6 +305,38 @@ export class PageImpl {
304
305
  }
305
306
  }
306
307
  }
308
+ async screenshot(options = {}) {
309
+ const handle = await this.#getHandle();
310
+ this.#ensureOpen(handle);
311
+ handle.stream.write({
312
+ surfaceSessionId: this.browserSessionId,
313
+ contextSessionId: this.sessionId,
314
+ screenshot: {
315
+ retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
316
+ fullPage: options.fullPage,
317
+ },
318
+ });
319
+ while (true) {
320
+ const event = await handle.queue.next();
321
+ if (event.screenshotCaptured?.pngData) {
322
+ const screenshot = {
323
+ pngData: event.screenshotCaptured.pngData,
324
+ note: event.screenshotCaptured.note ?? "",
325
+ };
326
+ if (options.path) {
327
+ await writeFile(options.path, screenshot.pngData);
328
+ }
329
+ return screenshot;
330
+ }
331
+ if (event.error?.message) {
332
+ throw formatActionError("screenshot", event.error.message);
333
+ }
334
+ if (event.closed) {
335
+ handle.closed = true;
336
+ throw new Error(`page session ${this.sessionId} closed while waiting for screenshot`);
337
+ }
338
+ }
339
+ }
307
340
  async close() {
308
341
  const handle = await this.#getHandle();
309
342
  if (handle.closed) {
@@ -318,7 +351,7 @@ export class PageImpl {
318
351
  const event = await handle.queue.next();
319
352
  if (event.closed) {
320
353
  handle.closed = true;
321
- handle.stream.end();
354
+ this.dispose();
322
355
  return;
323
356
  }
324
357
  if (event.error?.message) {
@@ -416,4 +449,28 @@ export class PageImpl {
416
449
  }
417
450
  return this.#handlePromise;
418
451
  }
452
+ dispose() {
453
+ const handlePromise = this.#handlePromise;
454
+ if (!handlePromise) {
455
+ return;
456
+ }
457
+ void handlePromise.then((handle) => {
458
+ if (handle.closed) {
459
+ return;
460
+ }
461
+ handle.closed = true;
462
+ try {
463
+ handle.stream.end();
464
+ }
465
+ catch {
466
+ // Best-effort local teardown during page disposal.
467
+ }
468
+ try {
469
+ handle.stream.cancel();
470
+ }
471
+ catch {
472
+ // grpc-js may reject cancel/end ordering depending on stream state.
473
+ }
474
+ });
475
+ }
419
476
  }
package/dist/runtime.js CHANGED
@@ -20,6 +20,10 @@ export async function shutdown() {
20
20
  return;
21
21
  }
22
22
  const runtime = await runtimePromise;
23
+ for (const stream of runtime.openStreams ?? []) {
24
+ closeTrackedStream(stream);
25
+ runtime.unregisterStream(stream);
26
+ }
23
27
  runtime.client.close();
24
28
  runtimePromise = null;
25
29
  await shutdownManagedServer();
@@ -44,6 +48,11 @@ export async function getRuntime() {
44
48
  }
45
49
  export async function createPageHandle(runtime) {
46
50
  const stream = runtime.client.ContextSession();
51
+ runtime.registerStream(stream);
52
+ const unregister = () => runtime.unregisterStream(stream);
53
+ stream.on("close", unregister);
54
+ stream.on("end", unregister);
55
+ stream.on("error", unregister);
47
56
  const queue = bindStreamQueue(stream);
48
57
  return {
49
58
  stream,
@@ -53,6 +62,11 @@ export async function createPageHandle(runtime) {
53
62
  }
54
63
  export async function createBrowserSessionHandle(runtime) {
55
64
  const stream = runtime.client.SurfaceSession();
65
+ runtime.registerStream(stream);
66
+ const unregister = () => runtime.unregisterStream(stream);
67
+ stream.on("close", unregister);
68
+ stream.on("end", unregister);
69
+ stream.on("error", unregister);
56
70
  const queue = bindStreamQueue(stream);
57
71
  return { stream, queue };
58
72
  }
@@ -93,7 +107,17 @@ async function createRuntime() {
93
107
  const proto = grpc.loadPackageDefinition(loaded);
94
108
  const ClientCtor = proto.allwright.engine.v1.EngineService;
95
109
  const client = new ClientCtor(resolvedServerAddr, grpc.credentials.createInsecure());
96
- return { client };
110
+ const openStreams = new Set();
111
+ return {
112
+ client,
113
+ openStreams,
114
+ registerStream(stream) {
115
+ openStreams.add(stream);
116
+ },
117
+ unregisterStream(stream) {
118
+ openStreams.delete(stream);
119
+ },
120
+ };
97
121
  }
98
122
  function configuredServerAddr() {
99
123
  if (serverAddrOverride) {
@@ -114,3 +138,17 @@ function bindStreamQueue(stream) {
114
138
  });
115
139
  return queue;
116
140
  }
141
+ function closeTrackedStream(stream) {
142
+ try {
143
+ stream.end();
144
+ }
145
+ catch {
146
+ // Some grpc-js stream states reject end() during teardown; keep going.
147
+ }
148
+ try {
149
+ stream.cancel();
150
+ }
151
+ catch {
152
+ // Best-effort shutdown so dangling streams do not keep the process alive.
153
+ }
154
+ }
package/dist/types.d.ts CHANGED
@@ -67,6 +67,14 @@ export interface WaitForSelectorResult {
67
67
  visible: boolean;
68
68
  note: string;
69
69
  }
70
+ export interface ScreenshotResult {
71
+ pngData: Uint8Array;
72
+ note: string;
73
+ }
74
+ export interface ScreenshotOptions extends CommandOptions {
75
+ fullPage?: boolean;
76
+ path?: string;
77
+ }
70
78
  export interface BrowserInfo {
71
79
  sessionId: string;
72
80
  browserName: string;
@@ -110,6 +118,7 @@ export interface Page extends PageInfo {
110
118
  textContent(selector: string, options?: CommandOptions): Promise<TextResult>;
111
119
  innerText(selector: string, options?: CommandOptions): Promise<TextResult>;
112
120
  waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
121
+ screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
113
122
  close(): Promise<void>;
114
123
  ping(message?: string): Promise<string>;
115
124
  pageInfo(): PageInfo;
@@ -139,6 +148,7 @@ export interface MobileAndroidApp {
139
148
  locator(selector: string): MobileAndroidLocator;
140
149
  click(selector: string, options?: CommandOptions): Promise<ClickResult>;
141
150
  fill(selector: string, value: string, options?: CommandOptions): Promise<FillResult>;
151
+ screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
142
152
  }
143
153
  export interface MobileAndroidDevice {
144
154
  readonly sessionId: string;
@@ -388,6 +398,10 @@ export interface ContextSessionEvent {
388
398
  visible?: boolean;
389
399
  note?: string;
390
400
  };
401
+ screenshotCaptured?: {
402
+ pngData?: Uint8Array;
403
+ note?: string;
404
+ };
391
405
  }
392
406
  export interface LaunchChromeRequest {
393
407
  launchChrome: {
@@ -565,13 +579,23 @@ export interface WaitForSelectorRequest {
565
579
  };
566
580
  };
567
581
  }
582
+ export interface ScreenshotRequest {
583
+ surfaceSessionId: string;
584
+ contextSessionId: string;
585
+ screenshot: {
586
+ retryOptions?: {
587
+ timeoutMs?: number;
588
+ };
589
+ fullPage?: boolean;
590
+ };
591
+ }
568
592
  export interface CloseContextRequest {
569
593
  surfaceSessionId: string;
570
594
  contextSessionId: string;
571
595
  close: Record<string, never>;
572
596
  }
573
597
  export type SurfaceSessionRequest = LaunchBrowserRequest | LaunchChromeRequest | OpenContextRequest | ConnectMobileRequest | LaunchAppRequest | SurfacePingRequest | CloseSurfaceRequest;
574
- export type ContextSessionRequest = ContextPingRequest | NavigateRequest | ClickRequest | CountRequest | HighlightRequest | FocusRequest | FillRequest | HoverRequest | PressRequest | TextContentRequest | InnerTextRequest | WaitForSelectorRequest | CloseContextRequest;
598
+ export type ContextSessionRequest = ContextPingRequest | NavigateRequest | ClickRequest | CountRequest | HighlightRequest | FocusRequest | FillRequest | HoverRequest | PressRequest | TextContentRequest | InnerTextRequest | WaitForSelectorRequest | ScreenshotRequest | CloseContextRequest;
575
599
  export type SurfaceSessionStream = grpc.ClientDuplexStream<SurfaceSessionRequest, SurfaceSessionEvent>;
576
600
  export type ContextSessionStream = grpc.ClientDuplexStream<ContextSessionRequest, ContextSessionEvent>;
577
601
  export interface EngineServiceClientShape {
@@ -591,6 +615,9 @@ export interface EngineProtoRoot {
591
615
  }
592
616
  export interface RuntimeClient {
593
617
  client: EngineServiceClientShape;
618
+ openStreams: Set<SurfaceSessionStream | ContextSessionStream>;
619
+ registerStream(stream: SurfaceSessionStream | ContextSessionStream): void;
620
+ unregisterStream(stream: SurfaceSessionStream | ContextSessionStream): void;
594
621
  }
595
622
  export interface BrowserLaunchState {
596
623
  runtime: RuntimeClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allwright.dev/core",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "description": "High-level TypeScript client for the allwright automation engine.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,215 @@
1
+ syntax = "proto3";
2
+
3
+ package allwright.engine.v1;
4
+ option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
+
6
+ import "core/v1/common.proto";
7
+
8
+ message ContextSessionCommand {
9
+ string surface_session_id = 1;
10
+ string context_session_id = 2;
11
+
12
+ oneof command {
13
+ ContextSessionPingCommand ping = 3;
14
+ CloseContextSessionCommand close = 4;
15
+ NavigatePageCommand navigate = 5;
16
+ ClickElementCommand click_element = 6;
17
+ CountElementsCommand count_elements = 7;
18
+ HighlightElementsCommand highlight_elements = 8;
19
+ FocusElementCommand focus_element = 9;
20
+ FillElementCommand fill_element = 10;
21
+ HoverElementCommand hover_element = 11;
22
+ PressKeyCommand press_key = 12;
23
+ GetTextContentCommand get_text_content = 13;
24
+ GetInnerTextCommand get_inner_text = 14;
25
+ WaitForSelectorCommand wait_for_selector = 15;
26
+ ScreenshotCommand screenshot = 16;
27
+ }
28
+ }
29
+
30
+ message ContextSessionPingCommand {
31
+ string message = 1;
32
+ }
33
+
34
+ message CloseContextSessionCommand {}
35
+
36
+ message ContextSessionEvent {
37
+ string context_session_id = 1;
38
+
39
+ oneof event {
40
+ ContextSessionAttachedEvent attached = 2;
41
+ ContextSessionPongEvent pong = 3;
42
+ ContextSessionClosedEvent closed = 4;
43
+ ContextSessionErrorEvent error = 5;
44
+ PageNavigatedEvent navigated = 6;
45
+ ChromiumBidiInjectionEvent chromium_bidi_injection = 7;
46
+ ElementClickedEvent element_clicked = 8;
47
+ ElementCountedEvent element_counted = 9;
48
+ ElementsHighlightedEvent elements_highlighted = 10;
49
+ ElementFocusedEvent element_focused = 11;
50
+ ElementFilledEvent element_filled = 12;
51
+ ElementHoveredEvent element_hovered = 13;
52
+ KeyPressedEvent key_pressed = 14;
53
+ TextContentResolvedEvent text_content_resolved = 15;
54
+ InnerTextResolvedEvent inner_text_resolved = 16;
55
+ SelectorWaitSatisfiedEvent selector_wait_satisfied = 17;
56
+ ScreenshotCapturedEvent screenshot_captured = 18;
57
+ }
58
+ }
59
+
60
+ message ContextSessionAttachedEvent {
61
+ string note = 1;
62
+ }
63
+
64
+ message ContextSessionPongEvent {
65
+ string message = 1;
66
+ }
67
+
68
+ message ContextSessionClosedEvent {
69
+ string reason = 1;
70
+ }
71
+
72
+ message ContextSessionErrorEvent {
73
+ string message = 1;
74
+ }
75
+
76
+ message NavigatePageCommand {
77
+ string url = 1;
78
+ optional CommandRetryOptions retry_options = 2;
79
+ }
80
+
81
+ message ClickElementCommand {
82
+ string css_selector = 1;
83
+ optional CommandRetryOptions retry_options = 2;
84
+ }
85
+
86
+ message CountElementsCommand {
87
+ string css_selector = 1;
88
+ optional CommandRetryOptions retry_options = 2;
89
+ }
90
+
91
+ message HighlightElementsCommand {
92
+ string css_selector = 1;
93
+ optional uint32 duration_ms = 2;
94
+ optional CommandRetryOptions retry_options = 3;
95
+ }
96
+
97
+ message FocusElementCommand {
98
+ string css_selector = 1;
99
+ optional CommandRetryOptions retry_options = 2;
100
+ }
101
+
102
+ message FillElementCommand {
103
+ string css_selector = 1;
104
+ string value = 2;
105
+ optional CommandRetryOptions retry_options = 3;
106
+ }
107
+
108
+ message HoverElementCommand {
109
+ string css_selector = 1;
110
+ optional CommandRetryOptions retry_options = 2;
111
+ }
112
+
113
+ message PressKeyCommand {
114
+ string css_selector = 1;
115
+ string key = 2;
116
+ optional string text = 3;
117
+ optional CommandRetryOptions retry_options = 4;
118
+ }
119
+
120
+ message GetTextContentCommand {
121
+ string css_selector = 1;
122
+ optional CommandRetryOptions retry_options = 2;
123
+ }
124
+
125
+ message GetInnerTextCommand {
126
+ string css_selector = 1;
127
+ optional CommandRetryOptions retry_options = 2;
128
+ }
129
+
130
+ message WaitForSelectorCommand {
131
+ string css_selector = 1;
132
+ optional bool visible = 2;
133
+ optional CommandRetryOptions retry_options = 3;
134
+ }
135
+
136
+ message ScreenshotCommand {
137
+ optional CommandRetryOptions retry_options = 1;
138
+ optional bool full_page = 2;
139
+ }
140
+
141
+ message PageNavigatedEvent {
142
+ string url = 1;
143
+ string note = 2;
144
+ }
145
+
146
+ message ChromiumBidiInjectionEvent {
147
+ string note = 1;
148
+ string bidi_session_id = 2;
149
+ string mapper_target_id = 3;
150
+ string mapper_session_id = 4;
151
+ string package_version = 5;
152
+ }
153
+
154
+ message ElementClickedEvent {
155
+ string css_selector = 1;
156
+ string note = 2;
157
+ string bidi_session_id = 3;
158
+ }
159
+
160
+ message ElementCountedEvent {
161
+ string css_selector = 1;
162
+ uint32 count = 2;
163
+ string note = 3;
164
+ }
165
+
166
+ message ElementsHighlightedEvent {
167
+ string css_selector = 1;
168
+ uint32 count = 2;
169
+ string note = 3;
170
+ }
171
+
172
+ message ElementFocusedEvent {
173
+ string css_selector = 1;
174
+ string note = 2;
175
+ }
176
+
177
+ message ElementFilledEvent {
178
+ string css_selector = 1;
179
+ string value = 2;
180
+ string note = 3;
181
+ }
182
+
183
+ message ElementHoveredEvent {
184
+ string css_selector = 1;
185
+ string note = 2;
186
+ }
187
+
188
+ message KeyPressedEvent {
189
+ string css_selector = 1;
190
+ string key = 2;
191
+ string note = 3;
192
+ }
193
+
194
+ message TextContentResolvedEvent {
195
+ string css_selector = 1;
196
+ string text = 2;
197
+ string note = 3;
198
+ }
199
+
200
+ message InnerTextResolvedEvent {
201
+ string css_selector = 1;
202
+ string text = 2;
203
+ string note = 3;
204
+ }
205
+
206
+ message SelectorWaitSatisfiedEvent {
207
+ string css_selector = 1;
208
+ bool visible = 2;
209
+ string note = 3;
210
+ }
211
+
212
+ message ScreenshotCapturedEvent {
213
+ bytes png_data = 1;
214
+ string note = 2;
215
+ }
@@ -3,9 +3,9 @@ syntax = "proto3";
3
3
  package allwright.engine.v1;
4
4
  option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
5
 
6
- import "core/v1/browser.proto";
6
+ import "core/v1/surface.proto";
7
7
  import "core/v1/common.proto";
8
- import "core/v1/tab.proto";
8
+ import "core/v1/context.proto";
9
9
 
10
10
  service EngineService {
11
11
  rpc Ping(PingRequest) returns (PingResponse);
@@ -37,134 +37,3 @@ message ChromeLaunchedEvent {
37
37
  string user_data_dir = 4;
38
38
  string initial_page_session_id = 5;
39
39
  }
40
-
41
- message NavigatePageCommand {
42
- string url = 1;
43
- optional CommandRetryOptions retry_options = 2;
44
- }
45
-
46
- message ClickElementCommand {
47
- string css_selector = 1;
48
- optional CommandRetryOptions retry_options = 2;
49
- }
50
-
51
- message CountElementsCommand {
52
- string css_selector = 1;
53
- optional CommandRetryOptions retry_options = 2;
54
- }
55
-
56
- message HighlightElementsCommand {
57
- string css_selector = 1;
58
- optional uint32 duration_ms = 2;
59
- optional CommandRetryOptions retry_options = 3;
60
- }
61
-
62
- message FocusElementCommand {
63
- string css_selector = 1;
64
- optional CommandRetryOptions retry_options = 2;
65
- }
66
-
67
- message FillElementCommand {
68
- string css_selector = 1;
69
- string value = 2;
70
- optional CommandRetryOptions retry_options = 3;
71
- }
72
-
73
- message HoverElementCommand {
74
- string css_selector = 1;
75
- optional CommandRetryOptions retry_options = 2;
76
- }
77
-
78
- message PressKeyCommand {
79
- string css_selector = 1;
80
- string key = 2;
81
- optional string text = 3;
82
- optional CommandRetryOptions retry_options = 4;
83
- }
84
-
85
- message GetTextContentCommand {
86
- string css_selector = 1;
87
- optional CommandRetryOptions retry_options = 2;
88
- }
89
-
90
- message GetInnerTextCommand {
91
- string css_selector = 1;
92
- optional CommandRetryOptions retry_options = 2;
93
- }
94
-
95
- message WaitForSelectorCommand {
96
- string css_selector = 1;
97
- optional bool visible = 2;
98
- optional CommandRetryOptions retry_options = 3;
99
- }
100
-
101
- message PageNavigatedEvent {
102
- string url = 1;
103
- string note = 2;
104
- }
105
-
106
- message ChromiumBidiInjectionEvent {
107
- string note = 1;
108
- string bidi_session_id = 2;
109
- string mapper_target_id = 3;
110
- string mapper_session_id = 4;
111
- string package_version = 5;
112
- }
113
-
114
- message ElementClickedEvent {
115
- string css_selector = 1;
116
- string note = 2;
117
- string bidi_session_id = 3;
118
- }
119
-
120
- message ElementCountedEvent {
121
- string css_selector = 1;
122
- uint32 count = 2;
123
- string note = 3;
124
- }
125
-
126
- message ElementsHighlightedEvent {
127
- string css_selector = 1;
128
- uint32 count = 2;
129
- string note = 3;
130
- }
131
-
132
- message ElementFocusedEvent {
133
- string css_selector = 1;
134
- string note = 2;
135
- }
136
-
137
- message ElementFilledEvent {
138
- string css_selector = 1;
139
- string value = 2;
140
- string note = 3;
141
- }
142
-
143
- message ElementHoveredEvent {
144
- string css_selector = 1;
145
- string note = 2;
146
- }
147
-
148
- message KeyPressedEvent {
149
- string css_selector = 1;
150
- string key = 2;
151
- string note = 3;
152
- }
153
-
154
- message TextContentResolvedEvent {
155
- string css_selector = 1;
156
- string text = 2;
157
- string note = 3;
158
- }
159
-
160
- message InnerTextResolvedEvent {
161
- string css_selector = 1;
162
- string text = 2;
163
- string note = 3;
164
- }
165
-
166
- message SelectorWaitSatisfiedEvent {
167
- string css_selector = 1;
168
- bool visible = 2;
169
- string note = 3;
170
- }
@@ -1,72 +0,0 @@
1
- syntax = "proto3";
2
-
3
- package allwright.engine.v1;
4
- option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
-
6
- import "surfaces/web/v1/web.proto";
7
-
8
- message ContextSessionCommand {
9
- string surface_session_id = 1;
10
- string context_session_id = 2;
11
-
12
- oneof command {
13
- ContextSessionPingCommand ping = 3;
14
- CloseContextSessionCommand close = 4;
15
- NavigatePageCommand navigate = 5;
16
- ClickElementCommand click_element = 6;
17
- CountElementsCommand count_elements = 7;
18
- HighlightElementsCommand highlight_elements = 8;
19
- FocusElementCommand focus_element = 9;
20
- FillElementCommand fill_element = 10;
21
- HoverElementCommand hover_element = 11;
22
- PressKeyCommand press_key = 12;
23
- GetTextContentCommand get_text_content = 13;
24
- GetInnerTextCommand get_inner_text = 14;
25
- WaitForSelectorCommand wait_for_selector = 15;
26
- }
27
- }
28
-
29
- message ContextSessionPingCommand {
30
- string message = 1;
31
- }
32
-
33
- message CloseContextSessionCommand {}
34
-
35
- message ContextSessionEvent {
36
- string context_session_id = 1;
37
-
38
- oneof event {
39
- ContextSessionAttachedEvent attached = 2;
40
- ContextSessionPongEvent pong = 3;
41
- ContextSessionClosedEvent closed = 4;
42
- ContextSessionErrorEvent error = 5;
43
- PageNavigatedEvent navigated = 6;
44
- ChromiumBidiInjectionEvent chromium_bidi_injection = 7;
45
- ElementClickedEvent element_clicked = 8;
46
- ElementCountedEvent element_counted = 9;
47
- ElementsHighlightedEvent elements_highlighted = 10;
48
- ElementFocusedEvent element_focused = 11;
49
- ElementFilledEvent element_filled = 12;
50
- ElementHoveredEvent element_hovered = 13;
51
- KeyPressedEvent key_pressed = 14;
52
- TextContentResolvedEvent text_content_resolved = 15;
53
- InnerTextResolvedEvent inner_text_resolved = 16;
54
- SelectorWaitSatisfiedEvent selector_wait_satisfied = 17;
55
- }
56
- }
57
-
58
- message ContextSessionAttachedEvent {
59
- string note = 1;
60
- }
61
-
62
- message ContextSessionPongEvent {
63
- string message = 1;
64
- }
65
-
66
- message ContextSessionClosedEvent {
67
- string reason = 1;
68
- }
69
-
70
- message ContextSessionErrorEvent {
71
- string message = 1;
72
- }
File without changes