playwright-ruby-client 0.7.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -0
  3. data/documentation/docs/api/browser.md +18 -2
  4. data/documentation/docs/api/browser_context.md +10 -0
  5. data/documentation/docs/api/browser_type.md +1 -0
  6. data/documentation/docs/api/cdp_session.md +41 -1
  7. data/documentation/docs/api/download.md +97 -0
  8. data/documentation/docs/api/element_handle.md +38 -4
  9. data/documentation/docs/api/experimental/android_device.md +1 -0
  10. data/documentation/docs/api/frame.md +78 -17
  11. data/documentation/docs/api/keyboard.md +11 -20
  12. data/documentation/docs/api/locator.md +650 -0
  13. data/documentation/docs/api/page.md +107 -19
  14. data/documentation/docs/api/response.md +16 -0
  15. data/documentation/docs/article/guides/inspector.md +31 -0
  16. data/documentation/docs/article/guides/playwright_on_alpine_linux.md +91 -0
  17. data/documentation/docs/article/guides/rails_integration.md +1 -1
  18. data/documentation/docs/article/guides/semi_automation.md +5 -1
  19. data/documentation/docs/include/api_coverage.md +70 -7
  20. data/lib/playwright.rb +36 -4
  21. data/lib/playwright/channel_owners/artifact.rb +4 -0
  22. data/lib/playwright/channel_owners/browser.rb +5 -0
  23. data/lib/playwright/channel_owners/browser_context.rb +37 -3
  24. data/lib/playwright/channel_owners/cdp_session.rb +19 -0
  25. data/lib/playwright/channel_owners/element_handle.rb +11 -4
  26. data/lib/playwright/channel_owners/frame.rb +103 -34
  27. data/lib/playwright/channel_owners/page.rb +140 -53
  28. data/lib/playwright/channel_owners/response.rb +9 -1
  29. data/lib/playwright/connection.rb +2 -4
  30. data/lib/playwright/{download.rb → download_impl.rb} +5 -1
  31. data/lib/playwright/javascript/expression.rb +5 -4
  32. data/lib/playwright/locator_impl.rb +314 -0
  33. data/lib/playwright/route_handler_entry.rb +3 -2
  34. data/lib/playwright/timeout_settings.rb +4 -4
  35. data/lib/playwright/transport.rb +0 -1
  36. data/lib/playwright/url_matcher.rb +12 -2
  37. data/lib/playwright/version.rb +2 -2
  38. data/lib/playwright/web_socket_client.rb +164 -0
  39. data/lib/playwright/web_socket_transport.rb +104 -0
  40. data/lib/playwright_api/android.rb +6 -6
  41. data/lib/playwright_api/android_device.rb +10 -9
  42. data/lib/playwright_api/browser.rb +17 -11
  43. data/lib/playwright_api/browser_context.rb +14 -9
  44. data/lib/playwright_api/browser_type.rb +8 -7
  45. data/lib/playwright_api/cdp_session.rb +30 -8
  46. data/lib/playwright_api/console_message.rb +6 -6
  47. data/lib/playwright_api/dialog.rb +6 -6
  48. data/lib/playwright_api/download.rb +70 -0
  49. data/lib/playwright_api/element_handle.rb +44 -24
  50. data/lib/playwright_api/frame.rb +100 -49
  51. data/lib/playwright_api/js_handle.rb +6 -6
  52. data/lib/playwright_api/locator.rb +509 -0
  53. data/lib/playwright_api/page.rb +110 -57
  54. data/lib/playwright_api/playwright.rb +6 -6
  55. data/lib/playwright_api/request.rb +6 -6
  56. data/lib/playwright_api/response.rb +15 -10
  57. data/lib/playwright_api/route.rb +6 -6
  58. data/lib/playwright_api/selectors.rb +6 -6
  59. data/lib/playwright_api/web_socket.rb +6 -6
  60. data/lib/playwright_api/worker.rb +6 -6
  61. metadata +15 -5
@@ -202,4 +202,4 @@ end
202
202
 
203
203
  * Playwright doesn't allow clicking invisible DOM elements or moving elements. `click` sometimes doesn't work as Selenium does. See the detail in https://playwright.dev/docs/actionability/
204
204
  * `current_window.maximize` and `current_window.fullscreen` work only on headful (non-headless) mode, as selenium driver does.
205
- * `Capybara::Node::Element#drag_to` does not accept `html5` parameter.
205
+ * `Capybara::Node::Element#drag_to` does not accept `html5` parameter. HTML5 drag and drop is not fully supported in Playwright.
@@ -1,3 +1,7 @@
1
+ ---
2
+ sidebar_position: 5
3
+ ---
4
+
1
5
  # Semi-automation
2
6
 
3
7
  Playwright Browser context is isolated and not persisted by default. But we can also use persistent browser context using [BrowserType#launch_persistent_context](/docs/api/browser_type#launch_persistent_context).
@@ -10,7 +14,7 @@ Keep in mind repeatedly that persistent browser context is NOT RECOMMENDED for m
10
14
 
11
15
  ## Pause automation for manual operation
12
16
 
13
- `Page#pause` is not implemented yet, however we can use `binding.pry` (with `pry-byebug` installed) instead.
17
+ We can simply use `binding.pry` (with `pry-byebug` installed).
14
18
 
15
19
  ```ruby {4}
16
20
  playwright.chromium.launch_persistent_context('./data/', headless: false) do |context|
@@ -26,6 +26,8 @@
26
26
  * json
27
27
  * ok
28
28
  * request
29
+ * security_details
30
+ * server_addr
29
31
  * status
30
32
  * status_text
31
33
  * text
@@ -91,6 +93,7 @@
91
93
  * hover
92
94
  * inner_html
93
95
  * inner_text
96
+ * input_value
94
97
  * checked?
95
98
  * disabled?
96
99
  * editable?
@@ -134,6 +137,7 @@
134
137
  * content
135
138
  * dblclick
136
139
  * dispatch_event
140
+ * drag_and_drop
137
141
  * eval_on_selector
138
142
  * eval_on_selector_all
139
143
  * evaluate
@@ -146,6 +150,7 @@
146
150
  * hover
147
151
  * inner_html
148
152
  * inner_text
153
+ * input_value
149
154
  * checked?
150
155
  * detached?
151
156
  * disabled?
@@ -153,6 +158,7 @@
153
158
  * enabled?
154
159
  * hidden?
155
160
  * visible?
161
+ * locator
156
162
  * name
157
163
  * page
158
164
  * parent_frame
@@ -200,6 +206,17 @@
200
206
  * message
201
207
  * type
202
208
 
209
+ ## Download
210
+
211
+ * cancel
212
+ * delete
213
+ * failure
214
+ * page
215
+ * path
216
+ * save_as
217
+ * suggested_filename
218
+ * url
219
+
203
220
  ## Page
204
221
 
205
222
  * add_init_script
@@ -213,6 +230,7 @@
213
230
  * context
214
231
  * dblclick
215
232
  * dispatch_event
233
+ * drag_and_drop
216
234
  * emulate_media
217
235
  * eval_on_selector
218
236
  * eval_on_selector_all
@@ -231,6 +249,7 @@
231
249
  * hover
232
250
  * inner_html
233
251
  * inner_text
252
+ * input_value
234
253
  * checked?
235
254
  * closed?
236
255
  * disabled?
@@ -238,9 +257,10 @@
238
257
  * enabled?
239
258
  * hidden?
240
259
  * visible?
260
+ * locator
241
261
  * main_frame
242
262
  * opener
243
- * ~~pause~~
263
+ * pause
244
264
  * pdf
245
265
  * press
246
266
  * query_selector
@@ -273,7 +293,7 @@
273
293
  * expect_navigation
274
294
  * expect_popup
275
295
  * expect_request
276
- * ~~expect_request_finished~~
296
+ * expect_request_finished
277
297
  * expect_response
278
298
  * wait_for_selector
279
299
  * ~~wait_for_timeout~~
@@ -300,7 +320,7 @@
300
320
  * expose_binding
301
321
  * expose_function
302
322
  * grant_permissions
303
- * ~~new_cdp_session~~
323
+ * new_cdp_session
304
324
  * new_page
305
325
  * pages
306
326
  * route
@@ -317,17 +337,17 @@
317
337
  * ~~wait_for_event~~
318
338
  * tracing
319
339
 
320
- ## ~~CDPSession~~
340
+ ## CDPSession
321
341
 
322
- * ~~detach~~
323
- * ~~send_message~~
342
+ * detach
343
+ * send_message
324
344
 
325
345
  ## Browser
326
346
 
327
347
  * close
328
348
  * contexts
329
349
  * connected?
330
- * ~~new_browser_cdp_session~~
350
+ * new_browser_cdp_session
331
351
  * new_context
332
352
  * new_page
333
353
  * start_tracing
@@ -357,6 +377,49 @@
357
377
  * start
358
378
  * stop
359
379
 
380
+ ## Locator
381
+
382
+ * all_inner_texts
383
+ * all_text_contents
384
+ * bounding_box
385
+ * check
386
+ * click
387
+ * count
388
+ * dblclick
389
+ * dispatch_event
390
+ * element_handle
391
+ * element_handles
392
+ * evaluate
393
+ * evaluate_all
394
+ * evaluate_handle
395
+ * fill
396
+ * first
397
+ * focus
398
+ * get_attribute
399
+ * hover
400
+ * inner_html
401
+ * inner_text
402
+ * input_value
403
+ * checked?
404
+ * disabled?
405
+ * editable?
406
+ * enabled?
407
+ * hidden?
408
+ * visible?
409
+ * last
410
+ * locator
411
+ * nth
412
+ * press
413
+ * screenshot
414
+ * scroll_into_view_if_needed
415
+ * select_option
416
+ * select_text
417
+ * set_input_files
418
+ * tap_point
419
+ * text_content
420
+ * type
421
+ * uncheck
422
+
360
423
  ## Android
361
424
 
362
425
  * devices
data/lib/playwright.rb CHANGED
@@ -17,7 +17,6 @@ require 'playwright/utils'
17
17
  require 'playwright/api_implementation'
18
18
  require 'playwright/channel'
19
19
  require 'playwright/channel_owner'
20
- require 'playwright/download'
21
20
  require 'playwright/http_headers'
22
21
  require 'playwright/input_files'
23
22
  require 'playwright/connection'
@@ -59,7 +58,8 @@ module Playwright
59
58
  # and we *must* call execution.stop on the end.
60
59
  # The instance of playwright is available by calling execution.playwright
61
60
  module_function def create(playwright_cli_executable_path:, &block)
62
- connection = Connection.new(playwright_cli_executable_path: playwright_cli_executable_path)
61
+ transport = Transport.new(playwright_cli_executable_path: playwright_cli_executable_path)
62
+ connection = Connection.new(transport)
63
63
  connection.async_run
64
64
 
65
65
  execution =
@@ -82,7 +82,39 @@ module Playwright
82
82
  end
83
83
  end
84
84
 
85
- module_function def instance
86
- @playwright_instance
85
+ # Connects to Playwright server, launched by `npx playwright run-server` via WebSocket transport.
86
+ #
87
+ # Playwright.connect_to_playwright_server(...) do |playwright|
88
+ # browser = playwright.chromium.launch
89
+ # ...
90
+ # end
91
+ #
92
+ # @experimental
93
+ module_function def connect_to_playwright_server(ws_endpoint, &block)
94
+ require 'playwright/web_socket_client'
95
+ require 'playwright/web_socket_transport'
96
+
97
+ transport = WebSocketTransport.new(ws_endpoint: ws_endpoint)
98
+ connection = Connection.new(transport)
99
+ connection.async_run
100
+
101
+ execution =
102
+ begin
103
+ playwright = connection.wait_for_object_with_known_name('Playwright')
104
+ Execution.new(connection, PlaywrightApi.wrap(playwright))
105
+ rescue
106
+ connection.stop
107
+ raise
108
+ end
109
+
110
+ if block
111
+ begin
112
+ block.call(execution.playwright)
113
+ ensure
114
+ execution.stop
115
+ end
116
+ else
117
+ execution
118
+ end
87
119
  end
88
120
  end
@@ -26,5 +26,9 @@ module Playwright
26
26
  def delete
27
27
  @channel.send_message_to_server('delete')
28
28
  end
29
+
30
+ def cancel
31
+ @channel.send_message_to_server('cancel')
32
+ end
29
33
  end
30
34
  end
@@ -67,6 +67,11 @@ module Playwright
67
67
  @initializer['version']
68
68
  end
69
69
 
70
+ def new_browser_cdp_session
71
+ resp = @channel.send_message_to_server('newBrowserCDPSession')
72
+ ChannelOwners::CDPSession.from(resp)
73
+ end
74
+
70
75
  def start_tracing(page: nil, categories: nil, path: nil, screenshots: nil)
71
76
  params = {
72
77
  page: page&.channel,
@@ -8,7 +8,7 @@ module Playwright
8
8
 
9
9
  private def after_initialize
10
10
  @pages = Set.new
11
- @routes = Set.new
11
+ @routes = []
12
12
  @bindings = {}
13
13
  @timeout_settings = TimeoutSettings.new
14
14
 
@@ -98,6 +98,11 @@ module Playwright
98
98
  page&.emit(Events::Page::Response, response)
99
99
  end
100
100
 
101
+ def new_cdp_session(page)
102
+ resp = @channel.send_message_to_server('newCDPSession', page: page.channel)
103
+ ChannelOwners::CDPSession.from(resp)
104
+ end
105
+
101
106
  def set_default_navigation_timeout(timeout)
102
107
  @timeout_settings.default_navigation_timeout = timeout
103
108
  @channel.send_message_to_server('setDefaultNavigationTimeoutNoReply', timeout: timeout)
@@ -205,8 +210,8 @@ module Playwright
205
210
  end
206
211
 
207
212
  def route(url, handler)
208
- entry = RouteHandlerEntry.new(url, handler)
209
- @routes << entry
213
+ entry = RouteHandlerEntry.new(url, base_url, handler)
214
+ @routes.unshift(entry)
210
215
  if @routes.count >= 1
211
216
  @channel.send_message_to_server('setNetworkInterceptionEnabled', enabled: true)
212
217
  end
@@ -245,7 +250,32 @@ module Playwright
245
250
  raise unless safe_close_error?(err)
246
251
  end
247
252
 
253
+ # REMARK: enable_debug_console is playwright-ruby-client specific method.
254
+ def enable_debug_console!
255
+ # Ruby is not supported in Playwright officially,
256
+ # and causes error:
257
+ #
258
+ # Error:
259
+ # ===============================
260
+ # Unsupported language: 'ruby'
261
+ # ===============================
262
+ #
263
+ # So, launch inspector as Python app.
264
+ # NOTE: This should be used only for Page#pause at this moment.
265
+ @channel.send_message_to_server('recorderSupplementEnable', language: :python)
266
+ @debug_console_enabled = true
267
+ end
268
+
269
+ class DebugConsoleNotEnabledError < StandardError
270
+ def initialize
271
+ super('Debug console should be enabled in advance, by calling `browser_context.enable_debug_console!`')
272
+ end
273
+ end
274
+
248
275
  def pause
276
+ unless @debug_console_enabled
277
+ raise DebugConsoleNotEnabledError.new
278
+ end
249
279
  @channel.send_message_to_server('pause')
250
280
  end
251
281
 
@@ -270,5 +300,9 @@ module Playwright
270
300
  private def has_record_video_option?
271
301
  @options.key?(:recordVideo)
272
302
  end
303
+
304
+ private def base_url
305
+ @options[:baseURL]
306
+ end
273
307
  end
274
308
  end
@@ -0,0 +1,19 @@
1
+ module Playwright
2
+ define_channel_owner :CDPSession do
3
+ private def after_initialize
4
+ @channel.on('event', method(:on_event))
5
+ end
6
+
7
+ private def on_event(params)
8
+ emit(params['method'], params['params'])
9
+ end
10
+
11
+ def send_message(method, params: {})
12
+ @channel.send_message_to_server('send', method: method, params: params)
13
+ end
14
+
15
+ def detach
16
+ @channel.send_message_to_server('detach')
17
+ end
18
+ end
19
+ end
@@ -146,6 +146,7 @@ module Playwright
146
146
  index: nil,
147
147
  value: nil,
148
148
  label: nil,
149
+ force: nil,
149
150
  noWaitAfter: nil,
150
151
  timeout: nil)
151
152
  base_params = SelectOptionValues.new(
@@ -154,7 +155,7 @@ module Playwright
154
155
  value: value,
155
156
  label: label,
156
157
  ).as_params
157
- params = base_params.merge({ noWaitAfter: noWaitAfter, timeout: timeout }.compact)
158
+ params = base_params.merge({ force: force, noWaitAfter: noWaitAfter, timeout: timeout }.compact)
158
159
  @channel.send_message_to_server('selectOption', params)
159
160
  end
160
161
 
@@ -179,9 +180,10 @@ module Playwright
179
180
  nil
180
181
  end
181
182
 
182
- def fill(value, noWaitAfter: nil, timeout: nil)
183
+ def fill(value, force: nil, noWaitAfter: nil, timeout: nil)
183
184
  params = {
184
185
  value: value,
186
+ force: force,
185
187
  noWaitAfter: noWaitAfter,
186
188
  timeout: timeout,
187
189
  }.compact
@@ -190,13 +192,18 @@ module Playwright
190
192
  nil
191
193
  end
192
194
 
193
- def select_text(timeout: nil)
194
- params = { timeout: timeout }.compact
195
+ def select_text(force: nil, timeout: nil)
196
+ params = { force: force, timeout: timeout }.compact
195
197
  @channel.send_message_to_server('selectText', params)
196
198
 
197
199
  nil
198
200
  end
199
201
 
202
+ def input_value(timeout: nil)
203
+ params = { timeout: timeout }.compact
204
+ @channel.send_message_to_server('inputValue', params)
205
+ end
206
+
200
207
  def set_input_files(files, noWaitAfter: nil, timeout: nil)
201
208
  file_payloads = InputFiles.new(files).as_params
202
209
  params = { files: file_payloads, noWaitAfter: noWaitAfter, timeout: timeout }.compact
@@ -71,7 +71,7 @@ module Playwright
71
71
 
72
72
  predicate =
73
73
  if url
74
- matcher = UrlMatcher.new(url)
74
+ matcher = UrlMatcher.new(url, base_url: @page.context.send(:base_url))
75
75
  ->(event) { event['error'] || matcher.match?(event['url']) }
76
76
  else
77
77
  ->(_) { true }
@@ -99,7 +99,7 @@ module Playwright
99
99
  end
100
100
 
101
101
  def wait_for_url(url, timeout: nil, waitUntil: nil)
102
- matcher = UrlMatcher.new(url)
102
+ matcher = UrlMatcher.new(url, base_url: @page.context.send(:base_url))
103
103
  if matcher.match?(@url)
104
104
  wait_for_load_state(state: waitUntil, timeout: timeout)
105
105
  else
@@ -139,8 +139,12 @@ module Playwright
139
139
  JavaScript::Expression.new(pageFunction, arg).evaluate_handle(@channel)
140
140
  end
141
141
 
142
- def query_selector(selector)
143
- resp = @channel.send_message_to_server('querySelector', selector: selector)
142
+ def query_selector(selector, strict: nil)
143
+ params = {
144
+ selector: selector,
145
+ strict: strict,
146
+ }.compact
147
+ resp = @channel.send_message_to_server('querySelector', params)
144
148
  ChannelOwners::ElementHandle.from_nullable(resp)
145
149
  end
146
150
 
@@ -150,48 +154,53 @@ module Playwright
150
154
  end
151
155
  end
152
156
 
153
- def wait_for_selector(selector, state: nil, timeout: nil)
154
- params = { selector: selector, state: state, timeout: timeout }.compact
157
+ def wait_for_selector(selector, state: nil, strict: nil, timeout: nil)
158
+ params = { selector: selector, state: state, strict: strict, timeout: timeout }.compact
155
159
  resp = @channel.send_message_to_server('waitForSelector', params)
156
160
 
157
161
  ChannelOwners::ElementHandle.from_nullable(resp)
158
162
  end
159
163
 
160
- def checked?(selector, timeout: nil)
161
- params = { selector: selector, timeout: timeout }.compact
164
+ def checked?(selector, strict: nil, timeout: nil)
165
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
162
166
  @channel.send_message_to_server('isChecked', params)
163
167
  end
164
168
 
165
- def disabled?(selector, timeout: nil)
166
- params = { selector: selector, timeout: timeout }.compact
169
+ def disabled?(selector, strict: nil, timeout: nil)
170
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
167
171
  @channel.send_message_to_server('isDisabled', params)
168
172
  end
169
173
 
170
- def editable?(selector, timeout: nil)
171
- params = { selector: selector, timeout: timeout }.compact
174
+ def editable?(selector, strict: nil, timeout: nil)
175
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
172
176
  @channel.send_message_to_server('isEditable', params)
173
177
  end
174
178
 
175
- def enabled?(selector, timeout: nil)
176
- params = { selector: selector, timeout: timeout }.compact
179
+ def enabled?(selector, strict: nil, timeout: nil)
180
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
177
181
  @channel.send_message_to_server('isEnabled', params)
178
182
  end
179
183
 
180
- def hidden?(selector, timeout: nil)
181
- params = { selector: selector, timeout: timeout }.compact
184
+ def hidden?(selector, strict: nil, timeout: nil)
185
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
182
186
  @channel.send_message_to_server('isHidden', params)
183
187
  end
184
188
 
185
- def visible?(selector, timeout: nil)
186
- params = { selector: selector, timeout: timeout }.compact
189
+ def visible?(selector, strict: nil, timeout: nil)
190
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
187
191
  @channel.send_message_to_server('isVisible', params)
188
192
  end
189
193
 
190
- def dispatch_event(selector, type, eventInit: nil, timeout: nil)
194
+ def locator(selector)
195
+ LocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), selector: selector)
196
+ end
197
+
198
+ def dispatch_event(selector, type, eventInit: nil, strict: nil, timeout: nil)
191
199
  params = {
192
200
  selector: selector,
193
201
  type: type,
194
202
  eventInit: JavaScript::ValueSerializer.new(eventInit).serialize,
203
+ strict: strict,
195
204
  timeout: timeout,
196
205
  }.compact
197
206
  @channel.send_message_to_server('dispatchEvent', params)
@@ -199,8 +208,8 @@ module Playwright
199
208
  nil
200
209
  end
201
210
 
202
- def eval_on_selector(selector, pageFunction, arg: nil)
203
- JavaScript::Expression.new(pageFunction, arg).eval_on_selector(@channel, selector)
211
+ def eval_on_selector(selector, pageFunction, arg: nil, strict: nil)
212
+ JavaScript::Expression.new(pageFunction, arg).eval_on_selector(@channel, selector, strict: strict)
204
213
  end
205
214
 
206
215
  def eval_on_selector_all(selector, pageFunction, arg: nil)
@@ -273,6 +282,7 @@ module Playwright
273
282
  modifiers: nil,
274
283
  noWaitAfter: nil,
275
284
  position: nil,
285
+ strict: nil,
276
286
  timeout: nil,
277
287
  trial: nil)
278
288
 
@@ -285,6 +295,7 @@ module Playwright
285
295
  modifiers: modifiers,
286
296
  noWaitAfter: noWaitAfter,
287
297
  position: position,
298
+ strict: strict,
288
299
  timeout: timeout,
289
300
  trial: trial,
290
301
  }.compact
@@ -293,6 +304,28 @@ module Playwright
293
304
  nil
294
305
  end
295
306
 
307
+ def drag_and_drop(
308
+ source,
309
+ target,
310
+ force: nil,
311
+ noWaitAfter: nil,
312
+ strict: nil,
313
+ timeout: nil,
314
+ trial: nil)
315
+ params = {
316
+ source: source,
317
+ target: target,
318
+ force: force,
319
+ noWaitAfter: noWaitAfter,
320
+ strict: strict,
321
+ timeout: timeout,
322
+ trial: trial,
323
+ }.compact
324
+ @channel.send_message_to_server('dragAndDrop', params)
325
+
326
+ nil
327
+ end
328
+
296
329
  def dblclick(
297
330
  selector,
298
331
  button: nil,
@@ -301,6 +334,7 @@ module Playwright
301
334
  modifiers: nil,
302
335
  noWaitAfter: nil,
303
336
  position: nil,
337
+ strict: nil,
304
338
  timeout: nil,
305
339
  trial: nil)
306
340
 
@@ -312,6 +346,7 @@ module Playwright
312
346
  modifiers: modifiers,
313
347
  noWaitAfter: noWaitAfter,
314
348
  position: position,
349
+ strict: strict,
315
350
  timeout: timeout,
316
351
  trial: trial,
317
352
  }.compact
@@ -326,6 +361,7 @@ module Playwright
326
361
  modifiers: nil,
327
362
  noWaitAfter: nil,
328
363
  position: nil,
364
+ strict: nil,
329
365
  timeout: nil,
330
366
  trial: nil)
331
367
  params = {
@@ -334,6 +370,7 @@ module Playwright
334
370
  modifiers: modifiers,
335
371
  noWaitAfter: noWaitAfter,
336
372
  position: position,
373
+ strict: strict,
337
374
  timeout: timeout,
338
375
  trial: trial,
339
376
  }.compact
@@ -342,11 +379,19 @@ module Playwright
342
379
  nil
343
380
  end
344
381
 
345
- def fill(selector, value, noWaitAfter: nil, timeout: nil)
382
+ def fill(
383
+ selector,
384
+ value,
385
+ force: nil,
386
+ noWaitAfter: nil,
387
+ strict: nil,
388
+ timeout: nil)
346
389
  params = {
347
390
  selector: selector,
348
391
  value: value,
392
+ force: force,
349
393
  noWaitAfter: noWaitAfter,
394
+ strict: strict,
350
395
  timeout: timeout,
351
396
  }.compact
352
397
  @channel.send_message_to_server('fill', params)
@@ -354,31 +399,32 @@ module Playwright
354
399
  nil
355
400
  end
356
401
 
357
- def focus(selector, timeout: nil)
358
- params = { selector: selector, timeout: timeout }.compact
402
+ def focus(selector, strict: nil, timeout: nil)
403
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
359
404
  @channel.send_message_to_server('focus', params)
360
405
  nil
361
406
  end
362
407
 
363
- def text_content(selector, timeout: nil)
364
- params = { selector: selector, timeout: timeout }.compact
408
+ def text_content(selector, strict: nil, timeout: nil)
409
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
365
410
  @channel.send_message_to_server('textContent', params)
366
411
  end
367
412
 
368
- def inner_text(selector, timeout: nil)
369
- params = { selector: selector, timeout: timeout }.compact
413
+ def inner_text(selector, strict: nil, timeout: nil)
414
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
370
415
  @channel.send_message_to_server('innerText', params)
371
416
  end
372
417
 
373
- def inner_html(selector, timeout: nil)
374
- params = { selector: selector, timeout: timeout }.compact
418
+ def inner_html(selector, strict: nil, timeout: nil)
419
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
375
420
  @channel.send_message_to_server('innerHTML', params)
376
421
  end
377
422
 
378
- def get_attribute(selector, name, timeout: nil)
423
+ def get_attribute(selector, name, strict: nil, timeout: nil)
379
424
  params = {
380
425
  selector: selector,
381
426
  name: name,
427
+ strict: strict,
382
428
  timeout: timeout,
383
429
  }.compact
384
430
  @channel.send_message_to_server('getAttribute', params)
@@ -389,6 +435,7 @@ module Playwright
389
435
  force: nil,
390
436
  modifiers: nil,
391
437
  position: nil,
438
+ strict: nil,
392
439
  timeout: nil,
393
440
  trial: nil)
394
441
  params = {
@@ -396,6 +443,7 @@ module Playwright
396
443
  force: force,
397
444
  modifiers: modifiers,
398
445
  position: position,
446
+ strict: strict,
399
447
  timeout: timeout,
400
448
  trial: trial,
401
449
  }.compact
@@ -410,7 +458,9 @@ module Playwright
410
458
  index: nil,
411
459
  value: nil,
412
460
  label: nil,
461
+ force: nil,
413
462
  noWaitAfter: nil,
463
+ strict: nil,
414
464
  timeout: nil)
415
465
  base_params = SelectOptionValues.new(
416
466
  element: element,
@@ -418,13 +468,24 @@ module Playwright
418
468
  value: value,
419
469
  label: label,
420
470
  ).as_params
421
- params = base_params.merge({ selector: selector, noWaitAfter: noWaitAfter, timeout: timeout }.compact)
471
+ params = base_params.merge({ selector: selector, force: force, noWaitAfter: noWaitAfter, strict: strict, timeout: timeout }.compact)
422
472
  @channel.send_message_to_server('selectOption', params)
423
473
  end
424
474
 
425
- def set_input_files(selector, files, noWaitAfter: nil, timeout: nil)
475
+ def input_value(selector, strict: nil, timeout: nil)
476
+ params = { selector: selector, strict: strict, timeout: timeout }.compact
477
+ @channel.send_message_to_server('inputValue', params)
478
+ end
479
+
480
+ def set_input_files(selector, files, noWaitAfter: nil, strict: nil, timeout: nil)
426
481
  file_payloads = InputFiles.new(files).as_params
427
- params = { files: file_payloads, selector: selector, noWaitAfter: noWaitAfter, timeout: timeout }.compact
482
+ params = {
483
+ files: file_payloads,
484
+ selector: selector,
485
+ noWaitAfter: noWaitAfter,
486
+ strict: strict,
487
+ timeout: timeout,
488
+ }.compact
428
489
  @channel.send_message_to_server('setInputFiles', params)
429
490
 
430
491
  nil
@@ -435,6 +496,7 @@ module Playwright
435
496
  text,
436
497
  delay: nil,
437
498
  noWaitAfter: nil,
499
+ strict: nil,
438
500
  timeout: nil)
439
501
 
440
502
  params = {
@@ -442,6 +504,7 @@ module Playwright
442
504
  text: text,
443
505
  delay: delay,
444
506
  noWaitAfter: noWaitAfter,
507
+ strict: strict,
445
508
  timeout: timeout,
446
509
  }.compact
447
510
  @channel.send_message_to_server('type', params)
@@ -454,6 +517,7 @@ module Playwright
454
517
  key,
455
518
  delay: nil,
456
519
  noWaitAfter: nil,
520
+ strict: nil,
457
521
  timeout: nil)
458
522
 
459
523
  params = {
@@ -461,6 +525,7 @@ module Playwright
461
525
  key: key,
462
526
  delay: delay,
463
527
  noWaitAfter: noWaitAfter,
528
+ strict: strict,
464
529
  timeout: timeout,
465
530
  }.compact
466
531
  @channel.send_message_to_server('press', params)
@@ -473,6 +538,7 @@ module Playwright
473
538
  force: nil,
474
539
  noWaitAfter: nil,
475
540
  position: nil,
541
+ strict: nil,
476
542
  timeout: nil,
477
543
  trial: nil)
478
544
 
@@ -481,6 +547,7 @@ module Playwright
481
547
  force: force,
482
548
  noWaitAfter: noWaitAfter,
483
549
  position: position,
550
+ strict: strict,
484
551
  timeout: timeout,
485
552
  trial: trial,
486
553
  }.compact
@@ -494,6 +561,7 @@ module Playwright
494
561
  force: nil,
495
562
  noWaitAfter: nil,
496
563
  position: nil,
564
+ strict: nil,
497
565
  timeout: nil,
498
566
  trial: nil)
499
567
 
@@ -502,6 +570,7 @@ module Playwright
502
570
  force: force,
503
571
  noWaitAfter: noWaitAfter,
504
572
  position: position,
573
+ strict: strict,
505
574
  timeout: timeout,
506
575
  trial: trial,
507
576
  }.compact