playwright-ruby-client 0.5.9 → 0.6.3

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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/documentation/README.md +33 -0
  4. data/documentation/babel.config.js +3 -0
  5. data/documentation/docs/api/accessibility.md +7 -0
  6. data/documentation/docs/api/browser.md +187 -0
  7. data/documentation/docs/api/browser_context.md +397 -0
  8. data/documentation/docs/api/browser_type.md +105 -0
  9. data/documentation/docs/api/cdp_session.md +7 -0
  10. data/documentation/docs/api/console_message.md +41 -0
  11. data/documentation/docs/api/dialog.md +71 -0
  12. data/documentation/docs/api/element_handle.md +618 -0
  13. data/documentation/docs/api/experimental/_category_.yml +3 -0
  14. data/documentation/docs/api/experimental/android.md +25 -0
  15. data/documentation/docs/api/experimental/android_device.md +92 -0
  16. data/documentation/docs/api/experimental/android_input.md +38 -0
  17. data/documentation/docs/api/experimental/android_socket.md +7 -0
  18. data/documentation/docs/api/experimental/android_web_view.md +7 -0
  19. data/documentation/docs/api/file_chooser.md +50 -0
  20. data/documentation/docs/api/frame.md +866 -0
  21. data/documentation/docs/api/js_handle.md +113 -0
  22. data/documentation/docs/api/keyboard.md +157 -0
  23. data/documentation/docs/api/mouse.md +69 -0
  24. data/documentation/docs/api/page.md +1402 -0
  25. data/documentation/docs/api/playwright.md +63 -0
  26. data/documentation/docs/api/request.md +188 -0
  27. data/documentation/docs/api/response.md +97 -0
  28. data/documentation/docs/api/route.md +80 -0
  29. data/documentation/docs/api/selectors.md +23 -0
  30. data/documentation/docs/api/touchscreen.md +8 -0
  31. data/documentation/docs/api/tracing.md +54 -0
  32. data/documentation/docs/api/web_socket.md +7 -0
  33. data/documentation/docs/api/worker.md +24 -0
  34. data/documentation/docs/article/api_coverage.mdx +11 -0
  35. data/documentation/docs/article/getting_started.md +152 -0
  36. data/documentation/docs/article/guides/_category_.yml +3 -0
  37. data/documentation/docs/article/guides/download_playwright_driver.md +49 -0
  38. data/documentation/docs/article/guides/launch_browser.md +119 -0
  39. data/documentation/docs/article/guides/rails_integration.md +162 -0
  40. data/{docs → documentation/docs/include}/api_coverage.md +12 -1
  41. data/documentation/docusaurus.config.js +107 -0
  42. data/documentation/package.json +39 -0
  43. data/documentation/sidebars.js +15 -0
  44. data/documentation/src/components/HomepageFeatures.js +61 -0
  45. data/documentation/src/components/HomepageFeatures.module.css +13 -0
  46. data/documentation/src/css/custom.css +44 -0
  47. data/documentation/src/pages/index.js +50 -0
  48. data/documentation/src/pages/index.module.css +41 -0
  49. data/documentation/src/pages/markdown-page.md +7 -0
  50. data/documentation/static/.nojekyll +0 -0
  51. data/documentation/static/img/playwright-logo.svg +9 -0
  52. data/documentation/static/img/undraw_dropdown_menu.svg +1 -0
  53. data/documentation/static/img/undraw_web_development.svg +1 -0
  54. data/documentation/static/img/undraw_windows.svg +1 -0
  55. data/documentation/yarn.lock +8805 -0
  56. data/lib/playwright/channel_owners/binding_call.rb +33 -0
  57. data/lib/playwright/channel_owners/browser.rb +11 -2
  58. data/lib/playwright/channel_owners/browser_context.rb +58 -6
  59. data/lib/playwright/channel_owners/browser_type.rb +8 -1
  60. data/lib/playwright/channel_owners/element_handle.rb +17 -16
  61. data/lib/playwright/channel_owners/frame.rb +24 -34
  62. data/lib/playwright/channel_owners/js_handle.rb +2 -10
  63. data/lib/playwright/channel_owners/page.rb +37 -52
  64. data/lib/playwright/channel_owners/worker.rb +4 -0
  65. data/lib/playwright/download.rb +3 -2
  66. data/lib/playwright/events.rb +4 -0
  67. data/lib/playwright/input_files.rb +0 -8
  68. data/lib/playwright/javascript.rb +0 -10
  69. data/lib/playwright/javascript/expression.rb +2 -7
  70. data/lib/playwright/playwright_api.rb +16 -1
  71. data/lib/playwright/tracing_impl.rb +31 -0
  72. data/lib/playwright/version.rb +2 -1
  73. data/lib/playwright_api/accessibility.rb +7 -88
  74. data/lib/playwright_api/android.rb +2 -59
  75. data/lib/playwright_api/android_device.rb +6 -5
  76. data/lib/playwright_api/browser.rb +13 -122
  77. data/lib/playwright_api/browser_context.rb +66 -433
  78. data/lib/playwright_api/browser_type.rb +28 -78
  79. data/lib/playwright_api/cdp_session.rb +2 -25
  80. data/lib/playwright_api/console_message.rb +2 -0
  81. data/lib/playwright_api/dialog.rb +5 -63
  82. data/lib/playwright_api/element_handle.rb +96 -294
  83. data/lib/playwright_api/file_chooser.rb +0 -21
  84. data/lib/playwright_api/frame.rb +98 -564
  85. data/lib/playwright_api/js_handle.rb +10 -67
  86. data/lib/playwright_api/keyboard.rb +22 -166
  87. data/lib/playwright_api/mouse.rb +1 -45
  88. data/lib/playwright_api/page.rb +223 -1224
  89. data/lib/playwright_api/playwright.rb +8 -93
  90. data/lib/playwright_api/request.rb +9 -87
  91. data/lib/playwright_api/response.rb +1 -1
  92. data/lib/playwright_api/route.rb +3 -80
  93. data/lib/playwright_api/selectors.rb +0 -66
  94. data/lib/playwright_api/tracing.rb +39 -0
  95. data/lib/playwright_api/web_socket.rb +1 -1
  96. data/lib/playwright_api/worker.rb +28 -42
  97. data/playwright.gemspec +2 -2
  98. metadata +60 -20
  99. data/lib/playwright/javascript/function.rb +0 -67
@@ -3,5 +3,38 @@ module Playwright
3
3
  def name
4
4
  @initializer['name']
5
5
  end
6
+
7
+ def call_async(callback)
8
+ Thread.new(callback) { call(callback) }
9
+ end
10
+
11
+ # @param callback [Proc]
12
+ def call(callback)
13
+ frame = ChannelOwners::Frame.from(@initializer['frame'])
14
+ # It is not desired to use PlaywrightApi.wrap directly.
15
+ # However it is a little difficult to define wrapper for `source` parameter in generate_api.
16
+ # Just a workaround...
17
+ source = {
18
+ context: PlaywrightApi.wrap(frame.page.context),
19
+ page: PlaywrightApi.wrap(frame.page),
20
+ frame: PlaywrightApi.wrap(frame),
21
+ }
22
+ args =
23
+ if @initializer['handle']
24
+ handle = ChannelOwners::ElementHandle.from(@initializer['handle'])
25
+ [handle]
26
+ else
27
+ @initializer['args'].map do |arg|
28
+ JavaScript::ValueParser.new(arg).parse
29
+ end
30
+ end
31
+
32
+ begin
33
+ result = PlaywrightApi.unwrap(callback.call(source, *args))
34
+ @channel.send_message_to_server('resolve', result: JavaScript::ValueSerializer.new(result).serialize)
35
+ rescue => err
36
+ @channel.send_message_to_server('reject', error: { error: { message: err.message, name: 'Error' }})
37
+ end
38
+ end
6
39
  end
7
40
  end
@@ -5,6 +5,10 @@ module Playwright
5
5
  include Utils::PrepareBrowserContextOptions
6
6
 
7
7
  private def after_initialize
8
+ @connected = true
9
+ @closed_or_closing = false
10
+ @remote = false
11
+
8
12
  @contexts = Set.new
9
13
  @channel.on('close', method(:on_close))
10
14
  end
@@ -77,8 +81,8 @@ module Playwright
77
81
 
78
82
  private def on_close(_ = {})
79
83
  @connected = false
80
- emit(Events::Browser::Disconnected)
81
- @closed_or_closing = false
84
+ emit(Events::Browser::Disconnected, self)
85
+ @closed_or_closing = true
82
86
  end
83
87
 
84
88
  # called from BrowserType#connectOverCDP
@@ -86,6 +90,11 @@ module Playwright
86
90
  @contexts << context
87
91
  end
88
92
 
93
+ # called from BrowserType#connectOverCDP
94
+ private def update_as_remote
95
+ @remote = true
96
+ end
97
+
89
98
  # called from BrowserContext#on_close with send(:remove_context), so keep private.
90
99
  private def remove_context(context)
91
100
  @contexts.delete(context)
@@ -4,6 +4,7 @@ module Playwright
4
4
  include Utils::Errors::SafeCloseError
5
5
  attr_accessor :browser
6
6
  attr_writer :owner_page, :options
7
+ attr_reader :tracing
7
8
 
8
9
  private def after_initialize
9
10
  @pages = Set.new
@@ -11,16 +12,45 @@ module Playwright
11
12
  @bindings = {}
12
13
  @timeout_settings = TimeoutSettings.new
13
14
 
15
+ @tracing = TracingImpl.new(@channel, self)
14
16
  @channel.on('bindingCall', ->(params) { on_binding(ChannelOwners::BindingCall.from(params['binding'])) })
15
17
  @channel.once('close', ->(_) { on_close })
16
18
  @channel.on('page', ->(params) { on_page(ChannelOwners::Page.from(params['page']) )})
17
19
  @channel.on('route', ->(params) {
18
20
  on_route(ChannelOwners::Route.from(params['route']), ChannelOwners::Request.from(params['request']))
19
21
  })
22
+ @channel.on('request', ->(params) {
23
+ on_request(
24
+ ChannelOwners::Request.from(params['request']),
25
+ ChannelOwners::Request.from_nullable(params['page']),
26
+ )
27
+ })
28
+ @channel.on('requestFailed', ->(params) {
29
+ on_request_failed(
30
+ ChannelOwners::Request.from(params['request']),
31
+ params['responseEndTiming'],
32
+ params['failureText'],
33
+ ChannelOwners::Request.from_nullable(params['page']),
34
+ )
35
+ })
36
+ @channel.on('requestFinished', ->(params) {
37
+ on_request_finished(
38
+ ChannelOwners::Request.from(params['request']),
39
+ params['responseEndTiming'],
40
+ ChannelOwners::Request.from_nullable(params['page']),
41
+ )
42
+ })
43
+ @channel.on('response', ->(params) {
44
+ on_response(
45
+ ChannelOwners::Response.from(params['response']),
46
+ ChannelOwners::Request.from_nullable(params['page']),
47
+ )
48
+ })
49
+
50
+ @closed_promise = Concurrent::Promises.resolvable_future
20
51
  end
21
52
 
22
53
  private def on_page(page)
23
- page.send(:update_browser_context, self)
24
54
  @pages << page
25
55
  emit(Events::BrowserContext::Page, page)
26
56
  page.send(:emit_popup_event_from_browser_context)
@@ -39,12 +69,35 @@ module Playwright
39
69
  end
40
70
 
41
71
  private def on_binding(binding_call)
42
- func = @binding[binding_call.name]
72
+ func = @bindings[binding_call.name]
43
73
  if func
44
- binding_call.call(func)
74
+ binding_call.call_async(func)
45
75
  end
46
76
  end
47
77
 
78
+ private def on_request_failed(request, response_end_timing, failure_text, page)
79
+ request.send(:update_failure_text, failure_text)
80
+ request.send(:update_response_end_timing, response_end_timing)
81
+ emit(Events::BrowserContext::RequestFailed, request)
82
+ page&.emit(Events::Page::RequestFailed, request)
83
+ end
84
+
85
+ private def on_request_finished(request, response_end_timing, page)
86
+ request.send(:update_response_end_timing, response_end_timing)
87
+ emit(Events::BrowserContext::RequestFinished, request)
88
+ page&.emit(Events::Page::RequestFinished, request)
89
+ end
90
+
91
+ private def on_request(request, page)
92
+ emit(Events::BrowserContext::Request, request)
93
+ page&.emit(Events::Page::Request, request)
94
+ end
95
+
96
+ private def on_response(response, page)
97
+ emit(Events::BrowserContext::Response, response)
98
+ page&.emit(Events::Page::Response, response)
99
+ end
100
+
48
101
  def set_default_navigation_timeout(timeout)
49
102
  @timeout_settings.default_navigation_timeout = timeout
50
103
  @channel.send_message_to_server('setDefaultNavigationTimeoutNoReply', timeout: timeout)
@@ -172,15 +225,14 @@ module Playwright
172
225
  end
173
226
 
174
227
  private def on_close
175
- @closed_or_closing = true
176
228
  @browser&.send(:remove_context, self)
177
229
  emit(Events::BrowserContext::Close)
230
+ @closed_promise.fulfill(true)
178
231
  end
179
232
 
180
233
  def close
181
- return if @closed_or_closing
182
- @closed_or_closing = true
183
234
  @channel.send_message_to_server('close')
235
+ @closed_promise.value!
184
236
  nil
185
237
  rescue => err
186
238
  raise unless safe_close_error?(err)
@@ -23,17 +23,24 @@ module Playwright
23
23
  end
24
24
  end
25
25
 
26
- def connect_over_cdp(endpointURL, slowMo: nil, timeout: nil, &block)
26
+ def connect_over_cdp(endpointURL, headers: nil, slowMo: nil, timeout: nil, &block)
27
27
  raise 'Connecting over CDP is only supported in Chromium.' unless name == 'chromium'
28
28
 
29
29
  params = {
30
30
  sdkLanguage: 'ruby',
31
31
  endpointURL: endpointURL,
32
+ headers: headers,
32
33
  slowMo: slowMo,
33
34
  timeout: timeout,
34
35
  }.compact
36
+
37
+ if headers
38
+ params[:headers] = HttpHeaders.new(headers).as_serialized
39
+ end
40
+
35
41
  result = @channel.send_message_to_server_result('connectOverCDP', params)
36
42
  browser = ChannelOwners::Browser.from(result['browser'])
43
+ browser.send(:update_as_remote)
37
44
 
38
45
  if result['defaultContext']
39
46
  context = ChannelOwners::BrowserContext.from(result['defaultContext'])
@@ -76,12 +76,13 @@ module Playwright
76
76
  nil
77
77
  end
78
78
 
79
- def hover(force: nil, modifiers: nil, position: nil, timeout: nil)
79
+ def hover(force: nil, modifiers: nil, position: nil, timeout: nil, trial: nil)
80
80
  params = {
81
81
  force: force,
82
82
  modifiers: modifiers,
83
83
  position: position,
84
84
  timeout: timeout,
85
+ trial: trial,
85
86
  }.compact
86
87
  @channel.send_message_to_server('hover', params)
87
88
 
@@ -96,7 +97,8 @@ module Playwright
96
97
  modifiers: nil,
97
98
  noWaitAfter: nil,
98
99
  position: nil,
99
- timeout: nil)
100
+ timeout: nil,
101
+ trial: nil)
100
102
 
101
103
  params = {
102
104
  button: button,
@@ -107,6 +109,7 @@ module Playwright
107
109
  noWaitAfter: noWaitAfter,
108
110
  position: position,
109
111
  timeout: timeout,
112
+ trial: trial,
110
113
  }.compact
111
114
  @channel.send_message_to_server('click', params)
112
115
 
@@ -120,7 +123,8 @@ module Playwright
120
123
  modifiers: nil,
121
124
  noWaitAfter: nil,
122
125
  position: nil,
123
- timeout: nil)
126
+ timeout: nil,
127
+ trial: nil)
124
128
 
125
129
  params = {
126
130
  button: button,
@@ -130,6 +134,7 @@ module Playwright
130
134
  noWaitAfter: noWaitAfter,
131
135
  position: position,
132
136
  timeout: timeout,
137
+ trial: trial,
133
138
  }.compact
134
139
  @channel.send_message_to_server('dblclick', params)
135
140
 
@@ -158,7 +163,8 @@ module Playwright
158
163
  modifiers: nil,
159
164
  noWaitAfter: nil,
160
165
  position: nil,
161
- timeout: nil)
166
+ timeout: nil,
167
+ trial: nil)
162
168
 
163
169
  params = {
164
170
  force: force,
@@ -166,6 +172,7 @@ module Playwright
166
172
  noWaitAfter: noWaitAfter,
167
173
  position: position,
168
174
  timeout: timeout,
175
+ trial: trial,
169
176
  }.compact
170
177
  @channel.send_message_to_server('tap', params)
171
178
 
@@ -228,24 +235,26 @@ module Playwright
228
235
  nil
229
236
  end
230
237
 
231
- def check(force: nil, noWaitAfter: nil, position: nil, timeout: nil)
238
+ def check(force: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil)
232
239
  params = {
233
240
  force: force,
234
241
  noWaitAfter: noWaitAfter,
235
242
  position: position,
236
243
  timeout: timeout,
244
+ trial: trial,
237
245
  }.compact
238
246
  @channel.send_message_to_server('check', params)
239
247
 
240
248
  nil
241
249
  end
242
250
 
243
- def uncheck(force: nil, noWaitAfter: nil, position: nil, timeout: nil)
251
+ def uncheck(force: nil, noWaitAfter: nil, position: nil, timeout: nil, trial: nil)
244
252
  params = {
245
253
  force: force,
246
254
  noWaitAfter: noWaitAfter,
247
255
  position: position,
248
256
  timeout: timeout,
257
+ trial: trial,
249
258
  }.compact
250
259
  @channel.send_message_to_server('uncheck', params)
251
260
 
@@ -292,19 +301,11 @@ module Playwright
292
301
  end
293
302
 
294
303
  def eval_on_selector(selector, pageFunction, arg: nil)
295
- if JavaScript.function?(pageFunction)
296
- JavaScript::Function.new(pageFunction, arg).eval_on_selector(@channel, selector)
297
- else
298
- JavaScript::Expression.new(pageFunction).eval_on_selector(@channel, selector)
299
- end
304
+ JavaScript::Expression.new(pageFunction, arg).eval_on_selector(@channel, selector)
300
305
  end
301
306
 
302
307
  def eval_on_selector_all(selector, pageFunction, arg: nil)
303
- if JavaScript.function?(pageFunction)
304
- JavaScript::Function.new(pageFunction, arg).eval_on_selector_all(@channel, selector)
305
- else
306
- JavaScript::Expression.new(pageFunction).eval_on_selector_all(@channel, selector)
307
- end
308
+ JavaScript::Expression.new(pageFunction, arg).eval_on_selector_all(@channel, selector)
308
309
  end
309
310
 
310
311
  def wait_for_element_state(state, timeout: nil)
@@ -132,19 +132,11 @@ module Playwright
132
132
  end
133
133
 
134
134
  def evaluate(pageFunction, arg: nil)
135
- if JavaScript.function?(pageFunction)
136
- JavaScript::Function.new(pageFunction, arg).evaluate(@channel)
137
- else
138
- JavaScript::Expression.new(pageFunction).evaluate(@channel)
139
- end
135
+ JavaScript::Expression.new(pageFunction, arg).evaluate(@channel)
140
136
  end
141
137
 
142
138
  def evaluate_handle(pageFunction, arg: nil)
143
- if JavaScript.function?(pageFunction)
144
- JavaScript::Function.new(pageFunction, arg).evaluate_handle(@channel)
145
- else
146
- JavaScript::Expression.new(pageFunction).evaluate_handle(@channel)
147
- end
139
+ JavaScript::Expression.new(pageFunction, arg).evaluate_handle(@channel)
148
140
  end
149
141
 
150
142
  def query_selector(selector)
@@ -208,19 +200,11 @@ module Playwright
208
200
  end
209
201
 
210
202
  def eval_on_selector(selector, pageFunction, arg: nil)
211
- if JavaScript.function?(pageFunction)
212
- JavaScript::Function.new(pageFunction, arg).eval_on_selector(@channel, selector)
213
- else
214
- JavaScript::Expression.new(pageFunction).eval_on_selector(@channel, selector)
215
- end
203
+ JavaScript::Expression.new(pageFunction, arg).eval_on_selector(@channel, selector)
216
204
  end
217
205
 
218
206
  def eval_on_selector_all(selector, pageFunction, arg: nil)
219
- if JavaScript.function?(pageFunction)
220
- JavaScript::Function.new(pageFunction, arg).eval_on_selector_all(@channel, selector)
221
- else
222
- JavaScript::Expression.new(pageFunction).eval_on_selector_all(@channel, selector)
223
- end
207
+ JavaScript::Expression.new(pageFunction, arg).eval_on_selector_all(@channel, selector)
224
208
  end
225
209
 
226
210
  def content
@@ -289,7 +273,8 @@ module Playwright
289
273
  modifiers: nil,
290
274
  noWaitAfter: nil,
291
275
  position: nil,
292
- timeout: nil)
276
+ timeout: nil,
277
+ trial: nil)
293
278
 
294
279
  params = {
295
280
  selector: selector,
@@ -301,6 +286,7 @@ module Playwright
301
286
  noWaitAfter: noWaitAfter,
302
287
  position: position,
303
288
  timeout: timeout,
289
+ trial: trial,
304
290
  }.compact
305
291
  @channel.send_message_to_server('click', params)
306
292
 
@@ -315,7 +301,8 @@ module Playwright
315
301
  modifiers: nil,
316
302
  noWaitAfter: nil,
317
303
  position: nil,
318
- timeout: nil)
304
+ timeout: nil,
305
+ trial: nil)
319
306
 
320
307
  params = {
321
308
  selector: selector,
@@ -326,6 +313,7 @@ module Playwright
326
313
  noWaitAfter: noWaitAfter,
327
314
  position: position,
328
315
  timeout: timeout,
316
+ trial: trial,
329
317
  }.compact
330
318
  @channel.send_message_to_server('dblclick', params)
331
319
 
@@ -338,7 +326,8 @@ module Playwright
338
326
  modifiers: nil,
339
327
  noWaitAfter: nil,
340
328
  position: nil,
341
- timeout: nil)
329
+ timeout: nil,
330
+ trial: nil)
342
331
  params = {
343
332
  selector: selector,
344
333
  force: force,
@@ -346,6 +335,7 @@ module Playwright
346
335
  noWaitAfter: noWaitAfter,
347
336
  position: position,
348
337
  timeout: timeout,
338
+ trial: trial,
349
339
  }.compact
350
340
  @channel.send_message_to_server('tap', params)
351
341
 
@@ -399,13 +389,15 @@ module Playwright
399
389
  force: nil,
400
390
  modifiers: nil,
401
391
  position: nil,
402
- timeout: nil)
392
+ timeout: nil,
393
+ trial: nil)
403
394
  params = {
404
395
  selector: selector,
405
396
  force: force,
406
397
  modifiers: modifiers,
407
398
  position: position,
408
399
  timeout: timeout,
400
+ trial: trial,
409
401
  }.compact
410
402
  @channel.send_message_to_server('hover', params)
411
403
 
@@ -481,7 +473,8 @@ module Playwright
481
473
  force: nil,
482
474
  noWaitAfter: nil,
483
475
  position: nil,
484
- timeout: nil)
476
+ timeout: nil,
477
+ trial: nil)
485
478
 
486
479
  params = {
487
480
  selector: selector,
@@ -489,6 +482,7 @@ module Playwright
489
482
  noWaitAfter: noWaitAfter,
490
483
  position: position,
491
484
  timeout: timeout,
485
+ trial: trial,
492
486
  }.compact
493
487
  @channel.send_message_to_server('check', params)
494
488
 
@@ -500,7 +494,8 @@ module Playwright
500
494
  force: nil,
501
495
  noWaitAfter: nil,
502
496
  position: nil,
503
- timeout: nil)
497
+ timeout: nil,
498
+ trial: nil)
504
499
 
505
500
  params = {
506
501
  selector: selector,
@@ -508,6 +503,7 @@ module Playwright
508
503
  noWaitAfter: noWaitAfter,
509
504
  position: position,
510
505
  timeout: timeout,
506
+ trial: trial,
511
507
  }.compact
512
508
  @channel.send_message_to_server('uncheck', params)
513
509
 
@@ -519,14 +515,8 @@ module Playwright
519
515
  raise ArgumentError.new("Unknown polling option: #{polling}")
520
516
  end
521
517
 
522
- function_or_expression =
523
- if JavaScript.function?(pageFunction)
524
- JavaScript::Function.new(pageFunction, arg)
525
- else
526
- JavaScript::Expression.new(pageFunction)
527
- end
528
-
529
- function_or_expression.wait_for_function(@channel, polling: polling, timeout: timeout)
518
+ expression = JavaScript::Expression.new(pageFunction, arg)
519
+ expression.wait_for_function(@channel, polling: polling, timeout: timeout)
530
520
  end
531
521
 
532
522
  def title