playwright-ruby-client 0.5.8 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
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 +51 -0
  40. data/{docs → documentation/docs/include}/api_coverage.md +13 -2
  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 +27 -2
  58. data/lib/playwright/channel_owners/browser_context.rb +54 -3
  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 +29 -34
  62. data/lib/playwright/channel_owners/js_handle.rb +2 -10
  63. data/lib/playwright/channel_owners/page.rb +35 -51
  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 +99 -565
  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 +222 -1223
  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 = true
11
+
8
12
  @contexts = Set.new
9
13
  @channel.on('close', method(:on_close))
10
14
  end
@@ -48,6 +52,14 @@ module Playwright
48
52
 
49
53
  def close
50
54
  return if @closed_or_closing
55
+ if @remote
56
+ @contexts.each do |context|
57
+ context.pages.each do |page|
58
+ page.send(:on_close)
59
+ end
60
+ context.send(:on_close)
61
+ end
62
+ end
51
63
  @closed_or_closing = true
52
64
  @channel.send_message_to_server('close')
53
65
  nil
@@ -77,8 +89,16 @@ module Playwright
77
89
 
78
90
  private def on_close(_ = {})
79
91
  @connected = false
80
- emit(Events::Browser::Disconnected)
81
- @closed_or_closing = false
92
+ if @remote
93
+ @contexts.each do |context|
94
+ context.pages.each do |page|
95
+ page.send(:on_close)
96
+ end
97
+ context.send(:on_close)
98
+ end
99
+ end
100
+ emit(Events::Browser::Disconnected, self)
101
+ @closed_or_closing = true
82
102
  end
83
103
 
84
104
  # called from BrowserType#connectOverCDP
@@ -86,6 +106,11 @@ module Playwright
86
106
  @contexts << context
87
107
  end
88
108
 
109
+ # called from BrowserType#connectOverCDP
110
+ private def update_as_remote
111
+ @remote = true
112
+ end
113
+
89
114
  # called from BrowserContext#on_close with send(:remove_context), so keep private.
90
115
  private def remove_context(context)
91
116
  @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,43 @@ 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
+ })
20
49
  end
21
50
 
22
51
  private def on_page(page)
23
- page.send(:update_browser_context, self)
24
52
  @pages << page
25
53
  emit(Events::BrowserContext::Page, page)
26
54
  page.send(:emit_popup_event_from_browser_context)
@@ -39,12 +67,35 @@ module Playwright
39
67
  end
40
68
 
41
69
  private def on_binding(binding_call)
42
- func = @binding[binding_call.name]
70
+ func = @bindings[binding_call.name]
43
71
  if func
44
- binding_call.call(func)
72
+ binding_call.call_async(func)
45
73
  end
46
74
  end
47
75
 
76
+ private def on_request_failed(request, response_end_timing, failure_text, page)
77
+ request.send(:update_failure_text, failure_text)
78
+ request.send(:update_response_end_timing, response_end_timing)
79
+ emit(Events::BrowserContext::RequestFailed, request)
80
+ page&.emit(Events::Page::RequestFailed, request)
81
+ end
82
+
83
+ private def on_request_finished(request, response_end_timing, page)
84
+ request.send(:update_response_end_timing, response_end_timing)
85
+ emit(Events::BrowserContext::RequestFinished, request)
86
+ page&.emit(Events::Page::RequestFinished, request)
87
+ end
88
+
89
+ private def on_request(request, page)
90
+ emit(Events::BrowserContext::Request, request)
91
+ page&.emit(Events::Page::Request, request)
92
+ end
93
+
94
+ private def on_response(response, page)
95
+ emit(Events::BrowserContext::Response, response)
96
+ page&.emit(Events::Page::Response, response)
97
+ end
98
+
48
99
  def set_default_navigation_timeout(timeout)
49
100
  @timeout_settings.default_navigation_timeout = timeout
50
101
  @channel.send_message_to_server('setDefaultNavigationTimeoutNoReply', timeout: timeout)
@@ -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)
@@ -126,20 +126,17 @@ module Playwright
126
126
  nil
127
127
  end
128
128
 
129
+ def frame_element
130
+ resp = @channel.send_message_to_server('frameElement')
131
+ ChannelOwners::ElementHandle.from(resp)
132
+ end
133
+
129
134
  def evaluate(pageFunction, arg: nil)
130
- if JavaScript.function?(pageFunction)
131
- JavaScript::Function.new(pageFunction, arg).evaluate(@channel)
132
- else
133
- JavaScript::Expression.new(pageFunction).evaluate(@channel)
134
- end
135
+ JavaScript::Expression.new(pageFunction, arg).evaluate(@channel)
135
136
  end
136
137
 
137
138
  def evaluate_handle(pageFunction, arg: nil)
138
- if JavaScript.function?(pageFunction)
139
- JavaScript::Function.new(pageFunction, arg).evaluate_handle(@channel)
140
- else
141
- JavaScript::Expression.new(pageFunction).evaluate_handle(@channel)
142
- end
139
+ JavaScript::Expression.new(pageFunction, arg).evaluate_handle(@channel)
143
140
  end
144
141
 
145
142
  def query_selector(selector)
@@ -203,19 +200,11 @@ module Playwright
203
200
  end
204
201
 
205
202
  def eval_on_selector(selector, pageFunction, arg: nil)
206
- if JavaScript.function?(pageFunction)
207
- JavaScript::Function.new(pageFunction, arg).eval_on_selector(@channel, selector)
208
- else
209
- JavaScript::Expression.new(pageFunction).eval_on_selector(@channel, selector)
210
- end
203
+ JavaScript::Expression.new(pageFunction, arg).eval_on_selector(@channel, selector)
211
204
  end
212
205
 
213
206
  def eval_on_selector_all(selector, pageFunction, arg: nil)
214
- if JavaScript.function?(pageFunction)
215
- JavaScript::Function.new(pageFunction, arg).eval_on_selector_all(@channel, selector)
216
- else
217
- JavaScript::Expression.new(pageFunction).eval_on_selector_all(@channel, selector)
218
- end
207
+ JavaScript::Expression.new(pageFunction, arg).eval_on_selector_all(@channel, selector)
219
208
  end
220
209
 
221
210
  def content
@@ -284,7 +273,8 @@ module Playwright
284
273
  modifiers: nil,
285
274
  noWaitAfter: nil,
286
275
  position: nil,
287
- timeout: nil)
276
+ timeout: nil,
277
+ trial: nil)
288
278
 
289
279
  params = {
290
280
  selector: selector,
@@ -296,6 +286,7 @@ module Playwright
296
286
  noWaitAfter: noWaitAfter,
297
287
  position: position,
298
288
  timeout: timeout,
289
+ trial: trial,
299
290
  }.compact
300
291
  @channel.send_message_to_server('click', params)
301
292
 
@@ -310,7 +301,8 @@ module Playwright
310
301
  modifiers: nil,
311
302
  noWaitAfter: nil,
312
303
  position: nil,
313
- timeout: nil)
304
+ timeout: nil,
305
+ trial: nil)
314
306
 
315
307
  params = {
316
308
  selector: selector,
@@ -321,6 +313,7 @@ module Playwright
321
313
  noWaitAfter: noWaitAfter,
322
314
  position: position,
323
315
  timeout: timeout,
316
+ trial: trial,
324
317
  }.compact
325
318
  @channel.send_message_to_server('dblclick', params)
326
319
 
@@ -333,7 +326,8 @@ module Playwright
333
326
  modifiers: nil,
334
327
  noWaitAfter: nil,
335
328
  position: nil,
336
- timeout: nil)
329
+ timeout: nil,
330
+ trial: nil)
337
331
  params = {
338
332
  selector: selector,
339
333
  force: force,
@@ -341,6 +335,7 @@ module Playwright
341
335
  noWaitAfter: noWaitAfter,
342
336
  position: position,
343
337
  timeout: timeout,
338
+ trial: trial,
344
339
  }.compact
345
340
  @channel.send_message_to_server('tap', params)
346
341
 
@@ -394,13 +389,15 @@ module Playwright
394
389
  force: nil,
395
390
  modifiers: nil,
396
391
  position: nil,
397
- timeout: nil)
392
+ timeout: nil,
393
+ trial: nil)
398
394
  params = {
399
395
  selector: selector,
400
396
  force: force,
401
397
  modifiers: modifiers,
402
398
  position: position,
403
399
  timeout: timeout,
400
+ trial: trial,
404
401
  }.compact
405
402
  @channel.send_message_to_server('hover', params)
406
403
 
@@ -476,7 +473,8 @@ module Playwright
476
473
  force: nil,
477
474
  noWaitAfter: nil,
478
475
  position: nil,
479
- timeout: nil)
476
+ timeout: nil,
477
+ trial: nil)
480
478
 
481
479
  params = {
482
480
  selector: selector,
@@ -484,6 +482,7 @@ module Playwright
484
482
  noWaitAfter: noWaitAfter,
485
483
  position: position,
486
484
  timeout: timeout,
485
+ trial: trial,
487
486
  }.compact
488
487
  @channel.send_message_to_server('check', params)
489
488
 
@@ -495,7 +494,8 @@ module Playwright
495
494
  force: nil,
496
495
  noWaitAfter: nil,
497
496
  position: nil,
498
- timeout: nil)
497
+ timeout: nil,
498
+ trial: nil)
499
499
 
500
500
  params = {
501
501
  selector: selector,
@@ -503,6 +503,7 @@ module Playwright
503
503
  noWaitAfter: noWaitAfter,
504
504
  position: position,
505
505
  timeout: timeout,
506
+ trial: trial,
506
507
  }.compact
507
508
  @channel.send_message_to_server('uncheck', params)
508
509
 
@@ -514,14 +515,8 @@ module Playwright
514
515
  raise ArgumentError.new("Unknown polling option: #{polling}")
515
516
  end
516
517
 
517
- function_or_expression =
518
- if JavaScript.function?(pageFunction)
519
- JavaScript::Function.new(pageFunction, arg)
520
- else
521
- JavaScript::Expression.new(pageFunction)
522
- end
523
-
524
- 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)
525
520
  end
526
521
 
527
522
  def title