@bctrl/sdk 1.0.1 → 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.
Files changed (279) hide show
  1. package/README.md +24 -29
  2. package/dist/bctrl.d.ts +22 -36
  3. package/dist/bctrl.js +40 -75
  4. package/dist/browsers.d.ts +24 -0
  5. package/dist/browsers.js +82 -0
  6. package/dist/errors.d.ts +49 -43
  7. package/dist/errors.js +83 -120
  8. package/dist/files.d.ts +31 -0
  9. package/dist/files.js +97 -0
  10. package/dist/http.d.ts +18 -0
  11. package/dist/http.js +135 -0
  12. package/dist/index.d.ts +9 -12
  13. package/dist/index.js +8 -23
  14. package/dist/invocations.d.ts +24 -0
  15. package/dist/invocations.js +66 -0
  16. package/dist/pagination.d.ts +2 -0
  17. package/dist/pagination.js +13 -0
  18. package/dist/runs.d.ts +38 -0
  19. package/dist/runs.js +99 -0
  20. package/dist/runtimes.d.ts +73 -0
  21. package/dist/runtimes.js +205 -0
  22. package/dist/spaces.d.ts +41 -0
  23. package/dist/spaces.js +96 -0
  24. package/dist/types.d.ts +386 -0
  25. package/dist/types.js +1 -0
  26. package/dist/utils.d.ts +4 -0
  27. package/dist/utils.js +27 -0
  28. package/dist/version.js +2 -2
  29. package/package.json +12 -31
  30. package/dist/agents/browser-use/index.d.ts +0 -1
  31. package/dist/agents/browser-use/index.js +0 -9
  32. package/dist/agents/browser-use/namespace.d.ts +0 -39
  33. package/dist/agents/browser-use/namespace.js +0 -93
  34. package/dist/agents/index.d.ts +0 -2
  35. package/dist/agents/index.js +0 -17
  36. package/dist/agents/stagehand/core.d.ts +0 -93
  37. package/dist/agents/stagehand/core.js +0 -144
  38. package/dist/agents/stagehand/index.d.ts +0 -3
  39. package/dist/agents/stagehand/index.js +0 -24
  40. package/dist/agents/stagehand/namespace.d.ts +0 -51
  41. package/dist/agents/stagehand/namespace.js +0 -65
  42. package/dist/ai-credentials/client.d.ts +0 -12
  43. package/dist/ai-credentials/client.js +0 -70
  44. package/dist/ai-credentials/index.d.ts +0 -1
  45. package/dist/ai-credentials/index.js +0 -1
  46. package/dist/base/event-binding.d.ts +0 -7
  47. package/dist/base/event-binding.js +0 -23
  48. package/dist/base/types.d.ts +0 -109
  49. package/dist/base/types.js +0 -4
  50. package/dist/browser-extensions/client.d.ts +0 -15
  51. package/dist/browser-extensions/client.js +0 -72
  52. package/dist/browser-extensions/index.d.ts +0 -2
  53. package/dist/browser-extensions/index.js +0 -1
  54. package/dist/browser-profiles/client.d.ts +0 -11
  55. package/dist/browser-profiles/client.js +0 -63
  56. package/dist/browser-profiles/index.d.ts +0 -1
  57. package/dist/browser-profiles/index.js +0 -1
  58. package/dist/captcha/index.d.ts +0 -1
  59. package/dist/captcha/index.js +0 -1
  60. package/dist/captcha/namespace.d.ts +0 -34
  61. package/dist/captcha/namespace.js +0 -41
  62. package/dist/client/index.d.ts +0 -1
  63. package/dist/client/index.js +0 -1
  64. package/dist/client/rpc.d.ts +0 -83
  65. package/dist/client/rpc.js +0 -354
  66. package/dist/config.d.ts +0 -5
  67. package/dist/config.js +0 -28
  68. package/dist/constants/browser.d.ts +0 -2
  69. package/dist/constants/browser.js +0 -1
  70. package/dist/contracts/agent-tools.d.ts +0 -45
  71. package/dist/contracts/agent-tools.js +0 -31
  72. package/dist/contracts/automation.d.ts +0 -265
  73. package/dist/contracts/automation.js +0 -109
  74. package/dist/contracts/browser-management.d.ts +0 -179
  75. package/dist/contracts/browser-management.js +0 -95
  76. package/dist/contracts/browser-use.d.ts +0 -136
  77. package/dist/contracts/browser-use.js +0 -93
  78. package/dist/contracts/captcha.d.ts +0 -114
  79. package/dist/contracts/captcha.js +0 -40
  80. package/dist/contracts/desktop.d.ts +0 -223
  81. package/dist/contracts/desktop.js +0 -121
  82. package/dist/contracts/drivers/playwright.d.ts +0 -2008
  83. package/dist/contracts/drivers/playwright.js +0 -2033
  84. package/dist/contracts/drivers/puppeteer.d.ts +0 -1221
  85. package/dist/contracts/drivers/puppeteer.js +0 -941
  86. package/dist/contracts/drivers/selenium.d.ts +0 -156
  87. package/dist/contracts/drivers/selenium.js +0 -61
  88. package/dist/contracts/drivers/stagehand.d.ts +0 -155
  89. package/dist/contracts/drivers/stagehand.js +0 -7
  90. package/dist/contracts/extensions.d.ts +0 -13
  91. package/dist/contracts/extensions.js +0 -9
  92. package/dist/contracts/index.d.ts +0 -13
  93. package/dist/contracts/index.js +0 -13
  94. package/dist/contracts/public-api.d.ts +0 -360
  95. package/dist/contracts/public-api.js +0 -17
  96. package/dist/contracts/runtime.d.ts +0 -81
  97. package/dist/contracts/runtime.js +0 -16
  98. package/dist/contracts/stagehand.d.ts +0 -253
  99. package/dist/contracts/stagehand.js +0 -145
  100. package/dist/contracts/storage.d.ts +0 -51
  101. package/dist/contracts/storage.js +0 -56
  102. package/dist/contracts/vault.d.ts +0 -119
  103. package/dist/contracts/vault.js +0 -112
  104. package/dist/contracts/version.d.ts +0 -3
  105. package/dist/contracts/version.js +0 -16
  106. package/dist/desktop.d.ts +0 -2
  107. package/dist/desktop.js +0 -3
  108. package/dist/drivers/desktop/index.d.ts +0 -65
  109. package/dist/drivers/desktop/index.js +0 -68
  110. package/dist/drivers/desktop/session.d.ts +0 -313
  111. package/dist/drivers/desktop/session.js +0 -432
  112. package/dist/drivers/playwright/event-emitter.d.ts +0 -160
  113. package/dist/drivers/playwright/event-emitter.js +0 -297
  114. package/dist/drivers/playwright/generated/api-request-context.d.ts +0 -137
  115. package/dist/drivers/playwright/generated/api-request-context.js +0 -154
  116. package/dist/drivers/playwright/generated/api-response.d.ts +0 -119
  117. package/dist/drivers/playwright/generated/api-response.js +0 -123
  118. package/dist/drivers/playwright/generated/browser-context.d.ts +0 -284
  119. package/dist/drivers/playwright/generated/browser-context.js +0 -458
  120. package/dist/drivers/playwright/generated/browser.d.ts +0 -120
  121. package/dist/drivers/playwright/generated/browser.js +0 -151
  122. package/dist/drivers/playwright/generated/clock.d.ts +0 -80
  123. package/dist/drivers/playwright/generated/clock.js +0 -94
  124. package/dist/drivers/playwright/generated/console-message.d.ts +0 -94
  125. package/dist/drivers/playwright/generated/console-message.js +0 -89
  126. package/dist/drivers/playwright/generated/coverage.d.ts +0 -57
  127. package/dist/drivers/playwright/generated/coverage.js +0 -66
  128. package/dist/drivers/playwright/generated/dialog.d.ts +0 -79
  129. package/dist/drivers/playwright/generated/dialog.js +0 -80
  130. package/dist/drivers/playwright/generated/element-handle.d.ts +0 -399
  131. package/dist/drivers/playwright/generated/element-handle.js +0 -501
  132. package/dist/drivers/playwright/generated/frame-locator.d.ts +0 -34
  133. package/dist/drivers/playwright/generated/frame-locator.js +0 -63
  134. package/dist/drivers/playwright/generated/frame.d.ts +0 -557
  135. package/dist/drivers/playwright/generated/frame.js +0 -634
  136. package/dist/drivers/playwright/generated/js-handle.d.ts +0 -72
  137. package/dist/drivers/playwright/generated/js-handle.js +0 -92
  138. package/dist/drivers/playwright/generated/keyboard.d.ts +0 -103
  139. package/dist/drivers/playwright/generated/keyboard.js +0 -113
  140. package/dist/drivers/playwright/generated/locator.d.ts +0 -795
  141. package/dist/drivers/playwright/generated/locator.js +0 -974
  142. package/dist/drivers/playwright/generated/mouse.d.ts +0 -97
  143. package/dist/drivers/playwright/generated/mouse.js +0 -109
  144. package/dist/drivers/playwright/generated/page.d.ts +0 -762
  145. package/dist/drivers/playwright/generated/page.js +0 -988
  146. package/dist/drivers/playwright/generated/touchscreen.d.ts +0 -34
  147. package/dist/drivers/playwright/generated/touchscreen.js +0 -37
  148. package/dist/drivers/playwright/generated/tracing.d.ts +0 -78
  149. package/dist/drivers/playwright/generated/tracing.js +0 -80
  150. package/dist/drivers/playwright/generated/worker.d.ts +0 -53
  151. package/dist/drivers/playwright/generated/worker.js +0 -59
  152. package/dist/drivers/playwright/index.d.ts +0 -19
  153. package/dist/drivers/playwright/index.js +0 -20
  154. package/dist/drivers/playwright/remote-base.d.ts +0 -62
  155. package/dist/drivers/playwright/remote-base.js +0 -86
  156. package/dist/drivers/playwright/types.d.ts +0 -148
  157. package/dist/drivers/playwright/types.js +0 -8
  158. package/dist/drivers/puppeteer/errors.d.ts +0 -50
  159. package/dist/drivers/puppeteer/errors.js +0 -71
  160. package/dist/drivers/puppeteer/event-emitter.d.ts +0 -145
  161. package/dist/drivers/puppeteer/event-emitter.js +0 -259
  162. package/dist/drivers/puppeteer/generated/accessibility.d.ts +0 -77
  163. package/dist/drivers/puppeteer/generated/accessibility.js +0 -74
  164. package/dist/drivers/puppeteer/generated/browser-context.d.ts +0 -116
  165. package/dist/drivers/puppeteer/generated/browser-context.js +0 -168
  166. package/dist/drivers/puppeteer/generated/browser.d.ts +0 -169
  167. package/dist/drivers/puppeteer/generated/browser.js +0 -246
  168. package/dist/drivers/puppeteer/generated/console-message.d.ts +0 -54
  169. package/dist/drivers/puppeteer/generated/console-message.js +0 -69
  170. package/dist/drivers/puppeteer/generated/coverage.d.ts +0 -49
  171. package/dist/drivers/puppeteer/generated/coverage.js +0 -57
  172. package/dist/drivers/puppeteer/generated/dialog.d.ts +0 -46
  173. package/dist/drivers/puppeteer/generated/dialog.js +0 -60
  174. package/dist/drivers/puppeteer/generated/element-handle.d.ts +0 -261
  175. package/dist/drivers/puppeteer/generated/element-handle.js +0 -341
  176. package/dist/drivers/puppeteer/generated/file-chooser.d.ts +0 -34
  177. package/dist/drivers/puppeteer/generated/file-chooser.js +0 -43
  178. package/dist/drivers/puppeteer/generated/frame.d.ts +0 -221
  179. package/dist/drivers/puppeteer/generated/frame.js +0 -302
  180. package/dist/drivers/puppeteer/generated/http-request.d.ts +0 -195
  181. package/dist/drivers/puppeteer/generated/http-request.js +0 -243
  182. package/dist/drivers/puppeteer/generated/http-response.d.ts +0 -142
  183. package/dist/drivers/puppeteer/generated/http-response.js +0 -169
  184. package/dist/drivers/puppeteer/generated/js-handle.d.ts +0 -104
  185. package/dist/drivers/puppeteer/generated/js-handle.js +0 -125
  186. package/dist/drivers/puppeteer/generated/keyboard.d.ts +0 -79
  187. package/dist/drivers/puppeteer/generated/keyboard.js +0 -89
  188. package/dist/drivers/puppeteer/generated/locator.d.ts +0 -141
  189. package/dist/drivers/puppeteer/generated/locator.js +0 -164
  190. package/dist/drivers/puppeteer/generated/mouse.d.ts +0 -74
  191. package/dist/drivers/puppeteer/generated/mouse.js +0 -94
  192. package/dist/drivers/puppeteer/generated/page.d.ts +0 -604
  193. package/dist/drivers/puppeteer/generated/page.js +0 -776
  194. package/dist/drivers/puppeteer/generated/target.d.ts +0 -105
  195. package/dist/drivers/puppeteer/generated/target.js +0 -123
  196. package/dist/drivers/puppeteer/generated/touchscreen.d.ts +0 -87
  197. package/dist/drivers/puppeteer/generated/touchscreen.js +0 -103
  198. package/dist/drivers/puppeteer/generated/tracing.d.ts +0 -38
  199. package/dist/drivers/puppeteer/generated/tracing.js +0 -43
  200. package/dist/drivers/puppeteer/generated/web-worker.d.ts +0 -63
  201. package/dist/drivers/puppeteer/generated/web-worker.js +0 -73
  202. package/dist/drivers/puppeteer/index.d.ts +0 -21
  203. package/dist/drivers/puppeteer/index.js +0 -23
  204. package/dist/drivers/puppeteer/remote-base.d.ts +0 -57
  205. package/dist/drivers/puppeteer/remote-base.js +0 -79
  206. package/dist/drivers/puppeteer/types.d.ts +0 -178
  207. package/dist/drivers/puppeteer/types.js +0 -8
  208. package/dist/drivers/selenium/driver.d.ts +0 -28
  209. package/dist/drivers/selenium/driver.js +0 -169
  210. package/dist/drivers/selenium/element.d.ts +0 -34
  211. package/dist/drivers/selenium/element.js +0 -73
  212. package/dist/drivers/selenium/index.d.ts +0 -3
  213. package/dist/drivers/selenium/index.js +0 -5
  214. package/dist/drivers/selenium/types.d.ts +0 -2
  215. package/dist/drivers/selenium/types.js +0 -12
  216. package/dist/drivers/stagehand/generated/context.d.ts +0 -127
  217. package/dist/drivers/stagehand/generated/context.js +0 -153
  218. package/dist/drivers/stagehand/generated/locator.d.ts +0 -324
  219. package/dist/drivers/stagehand/generated/locator.js +0 -368
  220. package/dist/drivers/stagehand/generated/page.d.ts +0 -377
  221. package/dist/drivers/stagehand/generated/page.js +0 -439
  222. package/dist/drivers/stagehand/generated/response.d.ts +0 -197
  223. package/dist/drivers/stagehand/generated/response.js +0 -232
  224. package/dist/drivers/stagehand/index.d.ts +0 -5
  225. package/dist/drivers/stagehand/index.js +0 -8
  226. package/dist/drivers/stagehand/types.d.ts +0 -1
  227. package/dist/drivers/stagehand/types.js +0 -7
  228. package/dist/extensions/client.d.ts +0 -47
  229. package/dist/extensions/client.js +0 -154
  230. package/dist/extensions/index.d.ts +0 -1
  231. package/dist/extensions/index.js +0 -1
  232. package/dist/internal/dev-client.d.ts +0 -5
  233. package/dist/internal/dev-client.js +0 -9
  234. package/dist/internal/rpc-targets.d.ts +0 -17
  235. package/dist/internal/rpc-targets.js +0 -58
  236. package/dist/internal/serialization.d.ts +0 -32
  237. package/dist/internal/serialization.js +0 -42
  238. package/dist/internal/transport.d.ts +0 -24
  239. package/dist/internal/transport.js +0 -29
  240. package/dist/playwright.d.ts +0 -1
  241. package/dist/playwright.js +0 -2
  242. package/dist/puppeteer.d.ts +0 -1
  243. package/dist/puppeteer.js +0 -2
  244. package/dist/selenium.d.ts +0 -1
  245. package/dist/selenium.js +0 -2
  246. package/dist/stagehand.d.ts +0 -1
  247. package/dist/stagehand.js +0 -2
  248. package/dist/storage/client.d.ts +0 -151
  249. package/dist/storage/client.js +0 -329
  250. package/dist/storage/index.d.ts +0 -2
  251. package/dist/storage/index.js +0 -4
  252. package/dist/telemetry.d.ts +0 -18
  253. package/dist/telemetry.js +0 -93
  254. package/dist/updates/client.d.ts +0 -8
  255. package/dist/updates/client.js +0 -128
  256. package/dist/updates/index.d.ts +0 -1
  257. package/dist/updates/index.js +0 -1
  258. package/dist/utils/http.d.ts +0 -39
  259. package/dist/utils/http.js +0 -88
  260. package/dist/utils/index.d.ts +0 -4
  261. package/dist/utils/index.js +0 -4
  262. package/dist/utils/logger.d.ts +0 -27
  263. package/dist/utils/logger.js +0 -74
  264. package/dist/utils/schema.d.ts +0 -17
  265. package/dist/utils/schema.js +0 -31
  266. package/dist/utils/url.d.ts +0 -5
  267. package/dist/utils/url.js +0 -7
  268. package/dist/vault/client.d.ts +0 -43
  269. package/dist/vault/client.js +0 -123
  270. package/dist/vault/index.d.ts +0 -1
  271. package/dist/vault/index.js +0 -1
  272. package/dist/workspaces/browser-runtime.d.ts +0 -251
  273. package/dist/workspaces/browser-runtime.js +0 -1025
  274. package/dist/workspaces/client.d.ts +0 -48
  275. package/dist/workspaces/client.js +0 -222
  276. package/dist/workspaces/index.d.ts +0 -2
  277. package/dist/workspaces/index.js +0 -2
  278. package/dist/workspaces/runtime-event-pump.d.ts +0 -65
  279. package/dist/workspaces/runtime-event-pump.js +0 -716
@@ -1,634 +0,0 @@
1
- /**
2
- * AUTO-GENERATED FILE - DO NOT EDIT
3
- *
4
- * Generated from: packages/automation-spec/src/drivers/playwright/methods/
5
- * Run `pnpm generate:playwright` to regenerate.
6
- */
7
- import { serializeFunctionSource } from '../../../internal/transport.js';
8
- import { RemoteBase } from '../remote-base.js';
9
- /**
10
- * RemotePlaywrightFrame - Remote Playwright Frame API over RPC.
11
- *
12
- * @see https://playwright.dev/docs/api/class-frame
13
- */
14
- export class RemotePlaywrightFrame extends RemoteBase {
15
- /** Whether this frame has been detached. */
16
- _isDetached;
17
- createElementHandle;
18
- createFrame;
19
- createLocator;
20
- createFrameLocator;
21
- createJSHandle;
22
- getPage;
23
- constructor(id, sendRpc, createElementHandle, createFrame, createLocator, createFrameLocator, createJSHandle, getPage) {
24
- super(id, sendRpc);
25
- this.createElementHandle = createElementHandle;
26
- this.createFrame = createFrame;
27
- this.createLocator = createLocator;
28
- this.createFrameLocator = createFrameLocator;
29
- this.createJSHandle = createJSHandle;
30
- this.getPage = getPage;
31
- }
32
- /**
33
- * The page associated with this frame.
34
- */
35
- page() {
36
- return this.getPage();
37
- }
38
- /**
39
- * Creates a Locator for the given selector.
40
- */
41
- locator(selector, options) {
42
- return this.createLocator(selector);
43
- }
44
- /**
45
- * Returns a FrameLocator for the given selector.
46
- */
47
- frameLocator(selector) {
48
- return this.createFrameLocator(selector);
49
- }
50
- /**
51
- * Allows locating elements by their ARIA role, ARIA attributes and accessible name.
52
- */
53
- getByRole(role, options) {
54
- // Create a special locator with role-based selector
55
- return this.createLocator(`role=${role}`);
56
- }
57
- /**
58
- * Allows locating elements that contain given text.
59
- */
60
- getByText(text, options) {
61
- const textStr = text instanceof RegExp ? text.source : text;
62
- return this.createLocator(`text=${textStr}`);
63
- }
64
- /**
65
- * Allows locating input elements by the text of the associated label.
66
- */
67
- getByLabel(text, options) {
68
- const textStr = text instanceof RegExp ? text.source : text;
69
- return this.createLocator(`label=${textStr}`);
70
- }
71
- /**
72
- * Allows locating input elements by the placeholder text.
73
- */
74
- getByPlaceholder(text, options) {
75
- const textStr = text instanceof RegExp ? text.source : text;
76
- return this.createLocator(`placeholder=${textStr}`);
77
- }
78
- /**
79
- * Allows locating elements by their alt text.
80
- */
81
- getByAltText(text, options) {
82
- const textStr = text instanceof RegExp ? text.source : text;
83
- return this.createLocator(`alt=${textStr}`);
84
- }
85
- /**
86
- * Allows locating elements by their title attribute.
87
- */
88
- getByTitle(text, options) {
89
- const textStr = text instanceof RegExp ? text.source : text;
90
- return this.createLocator(`title=${textStr}`);
91
- }
92
- /**
93
- * Locate element by the test id.
94
- */
95
- getByTestId(testId) {
96
- const testIdStr = testId instanceof RegExp ? testId.source : testId;
97
- return this.createLocator(`data-testid=${testIdStr}`);
98
- }
99
- /**
100
- * Evaluates a function in the frame's context and returns a handle to the result.
101
- * Note: Returns serialized handle reference. Full JSHandle support not yet available.
102
- */
103
- async evaluateHandle(pageFunction, arg) {
104
- const _pageFunction = serializeFunctionSource(pageFunction);
105
- const result = await this.rpc('evaluateHandle', [this.id, _pageFunction, arg]);
106
- return this.createJSHandle(result.id);
107
- }
108
- /**
109
- * Returns when the pageFunction returns a truthy value.
110
- * Note: Returns serialized handle reference. Full JSHandle support not yet available.
111
- */
112
- async waitForFunction(pageFunction, arg, options) {
113
- const _pageFunction = serializeFunctionSource(pageFunction);
114
- const result = await this.rpc('waitForFunction', [this.id, _pageFunction, arg, options]);
115
- return this.createJSHandle(result.id);
116
- }
117
- /**
118
- * Returns `true` if the frame has been detached, or `false` otherwise.
119
- *
120
- * @see https://playwright.dev/docs/api/class-frame#frame-is-detached
121
- */
122
- isDetached() {
123
- return this._isDetached;
124
- }
125
- /**
126
- * Returns the frame element associated with this frame.
127
- *
128
- * @remarks
129
- * Returns the ElementHandle for the <iframe> or <frame> tag for this frame. Returns null for the main frame.
130
- *
131
- * @see https://playwright.dev/docs/api/class-frame#frame-frame-element
132
- */
133
- async frameElement() {
134
- const result = await this.rpc('frameElement', []);
135
- return this.createElementHandle(result.id);
136
- }
137
- /**
138
- * Returns frame's URL.
139
- *
140
- * @see https://playwright.dev/docs/api/class-frame#frame-url
141
- */
142
- async url() {
143
- return this.rpc('url', []);
144
- }
145
- /**
146
- * Returns frame's name attribute as specified in the tag.
147
- *
148
- * @remarks
149
- * If the name is empty, returns the id attribute instead. Returns empty string if both name and id are empty.
150
- *
151
- * @see https://playwright.dev/docs/api/class-frame#frame-name
152
- */
153
- async name() {
154
- return this.rpc('name', []);
155
- }
156
- /**
157
- * Returns the page title.
158
- *
159
- * @see https://playwright.dev/docs/api/class-frame#frame-title
160
- */
161
- async title() {
162
- return this.rpc('title', []);
163
- }
164
- /**
165
- * Gets the full HTML contents of the frame, including the doctype.
166
- *
167
- * @see https://playwright.dev/docs/api/class-frame#frame-content
168
- */
169
- async content() {
170
- return this.rpc('content', []);
171
- }
172
- /**
173
- * Sets the content of the frame.
174
- *
175
- * @remarks
176
- * This method takes the HTML to set as the frame's content. The default waitUntil is 'load'.
177
- *
178
- * @see https://playwright.dev/docs/api/class-frame#frame-set-content
179
- */
180
- async setContent(html, options) {
181
- await this.rpc('setContent', [html, options]);
182
- }
183
- /**
184
- * Parent frame, if any. Detached frames and main frames return null.
185
- *
186
- * @see https://playwright.dev/docs/api/class-frame#frame-parent-frame
187
- */
188
- async parentFrame() {
189
- const result = await this.rpc('parentFrame', []);
190
- if (!result)
191
- return null;
192
- return this.createFrame(result.id);
193
- }
194
- /**
195
- * Returns child frames of this frame.
196
- *
197
- * @see https://playwright.dev/docs/api/class-frame#frame-child-frames
198
- */
199
- async childFrames() {
200
- const results = await this.rpc('childFrames', []);
201
- return results.map((r) => this.createFrame(r.id));
202
- }
203
- /**
204
- * Returns the main resource response.
205
- *
206
- * @remarks
207
- * Navigates the frame to the given URL. In case of multiple redirects, the navigation will resolve with the first non-redirect response. The method will throw an error if navigation fails. The method will not throw an error when any valid HTTP status code is returned by the remote server.
208
- *
209
- * @see https://playwright.dev/docs/api/class-frame#frame-goto
210
- */
211
- async goto(url, options) {
212
- return this.rpc('goto', [url, options]);
213
- }
214
- /**
215
- * Waits for the frame to navigate to the given URL.
216
- *
217
- * @remarks
218
- * This method can be used after an action that causes navigation. A glob pattern, regex pattern or predicate receiving URL to match while waiting for the navigation.
219
- *
220
- * @see https://playwright.dev/docs/api/class-frame#frame-wait-for-url
221
- */
222
- async waitForURL(url, options) {
223
- await this.rpc('waitForURL', [url, options]);
224
- }
225
- /**
226
- * Waits for the required load state to be reached.
227
- * @param state - State to wait for, defaults to load.
228
- *
229
- * @remarks
230
- * This method returns when the page reaches a required load state, 'load' by default. The navigation must have been committed when this method is called.
231
- *
232
- * @see https://playwright.dev/docs/api/class-frame#frame-wait-for-load-state
233
- */
234
- async waitForLoadState(state, options) {
235
- await this.rpc('waitForLoadState', [state, options]);
236
- }
237
- /**
238
- * Returns the ElementHandle pointing to the frame element.
239
- *
240
- * @remarks
241
- * This method queries the frame for the given selector. If no element matches the selector, returns null. Discouraged: use locator-based frame.locator() instead.
242
- *
243
- * @see https://playwright.dev/docs/api/class-frame#frame-query-selector
244
- */
245
- async $(selector) {
246
- const result = await this.rpc('$', [selector]);
247
- if (!result)
248
- return null;
249
- return this.createElementHandle(result.id);
250
- }
251
- /**
252
- * Returns the ElementHandles pointing to the frame elements.
253
- *
254
- * @remarks
255
- * This method queries the frame for all elements matching the given selector. Returns empty array if no elements match. Discouraged: use locator-based frame.locator() instead.
256
- *
257
- * @see https://playwright.dev/docs/api/class-frame#frame-query-selector-all
258
- */
259
- async $$(selector) {
260
- const results = await this.rpc('$$', [selector]);
261
- return results.map((r) => this.createElementHandle(r.id));
262
- }
263
- /**
264
- * Returns when element specified by selector satisfies state option.
265
- *
266
- * @remarks
267
- * Returns null if waiting for hidden or detached. Returns the ElementHandle matching the selector in visible/attached states. Discouraged: use locator-based locator.waitFor() instead.
268
- *
269
- * @see https://playwright.dev/docs/api/class-frame#frame-wait-for-selector
270
- */
271
- async waitForSelector(selector, options) {
272
- const result = await this.rpc('waitForSelector', [selector, options]);
273
- if (!result)
274
- return null;
275
- return this.createElementHandle(result.id);
276
- }
277
- /**
278
- * Waits for the given timeout in milliseconds.
279
- *
280
- * @remarks
281
- * Note: This should never be used in production. Tests that wait for time are inherently flaky. Use Locator actions and web assertions that wait automatically.
282
- *
283
- * @see https://playwright.dev/docs/api/class-frame#frame-wait-for-timeout
284
- */
285
- async waitForTimeout(timeout) {
286
- await this.rpc('waitForTimeout', [timeout]);
287
- }
288
- /**
289
- * Clicks an element matching selector.
290
- *
291
- * @remarks
292
- * This method waits for actionability checks, scrolls element into view, and then clicks the center of the element. Discouraged: use locator-based locator.click() instead.
293
- *
294
- * @see https://playwright.dev/docs/api/class-frame#frame-click
295
- */
296
- async click(selector, options) {
297
- await this.rpc('click', [selector, options]);
298
- }
299
- /**
300
- * Double-clicks an element matching selector.
301
- *
302
- * @remarks
303
- * This method waits for actionability checks, scrolls element into view, and then double-clicks the center of the element. Discouraged: use locator-based locator.dblclick() instead.
304
- *
305
- * @see https://playwright.dev/docs/api/class-frame#frame-dblclick
306
- */
307
- async dblclick(selector, options) {
308
- await this.rpc('dblclick', [selector, options]);
309
- }
310
- /**
311
- * Fills a form field with text.
312
- *
313
- * @remarks
314
- * This method waits for an element matching selector, waits for actionability checks, focuses the element, fills it and triggers an input event. Discouraged: use locator-based locator.fill() instead.
315
- *
316
- * @see https://playwright.dev/docs/api/class-frame#frame-fill
317
- */
318
- async fill(selector, value, options) {
319
- await this.rpc('fill', [selector, value, options]);
320
- }
321
- /**
322
- * Types into an element matching selector.
323
- *
324
- * @remarks
325
- * Sends a keydown, keypress/input, and keyup event for each character in the text. Discouraged: In most cases, you should use locator.fill() instead.
326
- *
327
- * @see https://playwright.dev/docs/api/class-frame#frame-type
328
- */
329
- async type(selector, text, options) {
330
- await this.rpc('type', [selector, text, options]);
331
- }
332
- /**
333
- * Presses a key.
334
- *
335
- * @remarks
336
- * Focuses the element matching selector, and then uses keyboard.press. Discouraged: use locator-based locator.press() instead.
337
- *
338
- * @see https://playwright.dev/docs/api/class-frame#frame-press
339
- */
340
- async press(selector, key, options) {
341
- await this.rpc('press', [selector, key, options]);
342
- }
343
- /**
344
- * Hovers over an element matching selector.
345
- *
346
- * @remarks
347
- * This method waits for actionability checks, scrolls element into view, and then hovers over the center of the element. Discouraged: use locator-based locator.hover() instead.
348
- *
349
- * @see https://playwright.dev/docs/api/class-frame#frame-hover
350
- */
351
- async hover(selector, options) {
352
- await this.rpc('hover', [selector, options]);
353
- }
354
- /**
355
- * Fetches the element matching selector and focuses it.
356
- *
357
- * @remarks
358
- * If there is no element matching selector, the method waits until a matching element appears in the DOM. Discouraged: use locator-based locator.focus() instead.
359
- *
360
- * @see https://playwright.dev/docs/api/class-frame#frame-focus
361
- */
362
- async focus(selector, options) {
363
- await this.rpc('focus', [selector, options]);
364
- }
365
- /**
366
- * Taps an element matching selector.
367
- *
368
- * @remarks
369
- * This method waits for actionability checks, scrolls element into view, and then taps the center of the element. Discouraged: use locator-based locator.tap() instead.
370
- *
371
- * @see https://playwright.dev/docs/api/class-frame#frame-tap
372
- */
373
- async tap(selector, options) {
374
- await this.rpc('tap', [selector, options]);
375
- }
376
- /**
377
- * Checks a checkbox or radio element.
378
- *
379
- * @remarks
380
- * This method checks an element matching selector by performing the following steps: scrolls element into view, and then uses click to check the element. Discouraged: use locator-based locator.check() instead.
381
- *
382
- * @see https://playwright.dev/docs/api/class-frame#frame-check
383
- */
384
- async check(selector, options) {
385
- await this.rpc('check', [selector, options]);
386
- }
387
- /**
388
- * Unchecks a checkbox element.
389
- *
390
- * @remarks
391
- * This method unchecks an element matching selector by scrolling element into view and using click to uncheck the element. Discouraged: use locator-based locator.uncheck() instead.
392
- *
393
- * @see https://playwright.dev/docs/api/class-frame#frame-uncheck
394
- */
395
- async uncheck(selector, options) {
396
- await this.rpc('uncheck', [selector, options]);
397
- }
398
- /**
399
- * Checks or unchecks a checkbox or radio element.
400
- *
401
- * @remarks
402
- * This method checks or unchecks an element matching selector. Discouraged: use locator-based locator.setChecked() instead.
403
- *
404
- * @see https://playwright.dev/docs/api/class-frame#frame-set-checked
405
- */
406
- async setChecked(selector, checked, options) {
407
- await this.rpc('setChecked', [selector, checked, options]);
408
- }
409
- /**
410
- * Selects option(s) in the select element.
411
- *
412
- * @remarks
413
- * Returns array of selected option values. Shortcuts such as "blue" match both value and label. Objects such as { label: "blue" } match by label only. Discouraged: use locator-based locator.selectOption() instead.
414
- *
415
- * @see https://playwright.dev/docs/api/class-frame#frame-select-option
416
- */
417
- async selectOption(selector, values, options) {
418
- return this.rpc('selectOption', [selector, values, options]);
419
- }
420
- /**
421
- * Sets the file input element to the given files.
422
- *
423
- * @remarks
424
- * Empty array clears the selected files. Discouraged: use locator-based locator.setInputFiles() instead.
425
- *
426
- * @see https://playwright.dev/docs/api/class-frame#frame-set-input-files
427
- */
428
- async setInputFiles(selector, files, options) {
429
- await this.rpc('setInputFiles', [selector, files, options]);
430
- }
431
- /**
432
- * Drags source element to target element.
433
- *
434
- * @remarks
435
- * This method drags the source element to the target element. It will first move to the source element, perform a mousedown, then move to the target element and perform a mouseup.
436
- *
437
- * @see https://playwright.dev/docs/api/class-frame#frame-drag-and-drop
438
- */
439
- async dragAndDrop(source, target, options) {
440
- await this.rpc('dragAndDrop', [source, target, options]);
441
- }
442
- /**
443
- * Dispatches an event on the element.
444
- *
445
- * @remarks
446
- * This method dispatches a DOM event on the element matching selector. Events are composed, cancelable, and bubble by default. Discouraged: use locator-based locator.dispatchEvent() instead.
447
- *
448
- * @see https://playwright.dev/docs/api/class-frame#frame-dispatch-event
449
- */
450
- async dispatchEvent(selector, type, eventInit, options) {
451
- await this.rpc('dispatchEvent', [selector, type, eventInit, options]);
452
- }
453
- /**
454
- * Returns the element.textContent.
455
- *
456
- * @remarks
457
- * Discouraged: use locator-based locator.textContent() instead.
458
- *
459
- * @see https://playwright.dev/docs/api/class-frame#frame-text-content
460
- */
461
- async textContent(selector, options) {
462
- return this.rpc('textContent', [selector, options]);
463
- }
464
- /**
465
- * Returns the element.innerText.
466
- *
467
- * @remarks
468
- * Discouraged: use locator-based locator.innerText() instead.
469
- *
470
- * @see https://playwright.dev/docs/api/class-frame#frame-inner-text
471
- */
472
- async innerText(selector, options) {
473
- return this.rpc('innerText', [selector, options]);
474
- }
475
- /**
476
- * Returns the element.innerHTML.
477
- *
478
- * @remarks
479
- * Discouraged: use locator-based locator.innerHTML() instead.
480
- *
481
- * @see https://playwright.dev/docs/api/class-frame#frame-inner-html
482
- */
483
- async innerHTML(selector, options) {
484
- return this.rpc('innerHTML', [selector, options]);
485
- }
486
- /**
487
- * Returns element attribute value.
488
- *
489
- * @remarks
490
- * Discouraged: use locator-based locator.getAttribute() instead.
491
- *
492
- * @see https://playwright.dev/docs/api/class-frame#frame-get-attribute
493
- */
494
- async getAttribute(selector, name, options) {
495
- return this.rpc('getAttribute', [selector, name, options]);
496
- }
497
- /**
498
- * Returns input.value for the selected <input> or <textarea> or <select> element.
499
- *
500
- * @remarks
501
- * Throws for non-input elements. Discouraged: use locator-based locator.inputValue() instead.
502
- *
503
- * @see https://playwright.dev/docs/api/class-frame#frame-input-value
504
- */
505
- async inputValue(selector, options) {
506
- return this.rpc('inputValue', [selector, options]);
507
- }
508
- /**
509
- * Returns whether the element is checked.
510
- *
511
- * @remarks
512
- * Throws if the element is not a checkbox or radio input. Discouraged: use locator-based locator.isChecked() instead.
513
- *
514
- * @see https://playwright.dev/docs/api/class-frame#frame-is-checked
515
- */
516
- async isChecked(selector, options) {
517
- return this.rpc('isChecked', [selector, options]);
518
- }
519
- /**
520
- * Returns whether the element is disabled.
521
- *
522
- * @remarks
523
- * Discouraged: use locator-based locator.isDisabled() instead.
524
- *
525
- * @see https://playwright.dev/docs/api/class-frame#frame-is-disabled
526
- */
527
- async isDisabled(selector, options) {
528
- return this.rpc('isDisabled', [selector, options]);
529
- }
530
- /**
531
- * Returns whether the element is editable.
532
- *
533
- * @remarks
534
- * Discouraged: use locator-based locator.isEditable() instead.
535
- *
536
- * @see https://playwright.dev/docs/api/class-frame#frame-is-editable
537
- */
538
- async isEditable(selector, options) {
539
- return this.rpc('isEditable', [selector, options]);
540
- }
541
- /**
542
- * Returns whether the element is enabled.
543
- *
544
- * @remarks
545
- * Discouraged: use locator-based locator.isEnabled() instead.
546
- *
547
- * @see https://playwright.dev/docs/api/class-frame#frame-is-enabled
548
- */
549
- async isEnabled(selector, options) {
550
- return this.rpc('isEnabled', [selector, options]);
551
- }
552
- /**
553
- * Returns whether the element is hidden.
554
- *
555
- * @remarks
556
- * Opposite of isVisible(). Discouraged: use locator-based locator.isHidden() instead.
557
- *
558
- * @see https://playwright.dev/docs/api/class-frame#frame-is-hidden
559
- */
560
- async isHidden(selector, options) {
561
- return this.rpc('isHidden', [selector, options]);
562
- }
563
- /**
564
- * Returns whether the element is visible.
565
- *
566
- * @remarks
567
- * Element is considered visible if it has non-zero bounding box and is not visibility:hidden. Discouraged: use locator-based locator.isVisible() instead.
568
- *
569
- * @see https://playwright.dev/docs/api/class-frame#frame-is-visible
570
- */
571
- async isVisible(selector, options) {
572
- return this.rpc('isVisible', [selector, options]);
573
- }
574
- /**
575
- * Evaluates JavaScript in the frame context.
576
- *
577
- * @remarks
578
- * Returns the return value of pageFunction. If the function returns a Promise, evaluate will wait for that Promise to resolve and return its value.
579
- *
580
- * @see https://playwright.dev/docs/api/class-frame#frame-evaluate
581
- */
582
- async evaluate(pageFunction, arg) {
583
- const _pageFunction = serializeFunctionSource(pageFunction);
584
- return this.rpc('evaluate', [_pageFunction, arg]);
585
- }
586
- /**
587
- * Finds an element matching selector and passes it to pageFunction.
588
- *
589
- * @remarks
590
- * Returns the value of pageFunction. Throws if selector matches no elements. Discouraged: use locator-based locator.evaluate() instead.
591
- *
592
- * @see https://playwright.dev/docs/api/class-frame#frame-eval-on-selector
593
- */
594
- async $eval(selector, pageFunction, arg) {
595
- const _pageFunction = serializeFunctionSource(pageFunction);
596
- return this.rpc('$eval', [selector, _pageFunction, arg]);
597
- }
598
- /**
599
- * Finds all elements matching selector and passes them to pageFunction.
600
- *
601
- * @remarks
602
- * Returns the value of pageFunction. Discouraged: use locator-based locator.evaluateAll() instead.
603
- *
604
- * @see https://playwright.dev/docs/api/class-frame#frame-eval-on-selector-all
605
- */
606
- async $$eval(selector, pageFunction, arg) {
607
- const _pageFunction = serializeFunctionSource(pageFunction);
608
- return this.rpc('$$eval', [selector, _pageFunction, arg]);
609
- }
610
- /**
611
- * Adds a <script> tag into the page with the desired url or content.
612
- *
613
- * @remarks
614
- * Returns the added tag when the script's onload fires or when the script content was injected into frame.
615
- *
616
- * @see https://playwright.dev/docs/api/class-frame#frame-add-script-tag
617
- */
618
- async addScriptTag(options) {
619
- const result = await this.rpc('addScriptTag', [options]);
620
- return this.createElementHandle(result.id);
621
- }
622
- /**
623
- * Adds a <style> tag into the page with the desired url or content.
624
- *
625
- * @remarks
626
- * Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.
627
- *
628
- * @see https://playwright.dev/docs/api/class-frame#frame-add-style-tag
629
- */
630
- async addStyleTag(options) {
631
- const result = await this.rpc('addStyleTag', [options]);
632
- return this.createElementHandle(result.id);
633
- }
634
- }