playwright-ruby-client 1.21.0 → 1.24.0

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/browser.md +30 -5
  3. data/documentation/docs/api/browser_context.md +20 -7
  4. data/documentation/docs/api/browser_type.md +4 -0
  5. data/documentation/docs/api/download.md +1 -1
  6. data/documentation/docs/api/element_handle.md +20 -12
  7. data/documentation/docs/api/experimental/android.md +1 -1
  8. data/documentation/docs/api/experimental/android_device.md +4 -0
  9. data/documentation/docs/api/file_chooser.md +2 -2
  10. data/documentation/docs/api/frame.md +12 -5
  11. data/documentation/docs/api/locator.md +43 -13
  12. data/documentation/docs/api/page.md +31 -11
  13. data/documentation/docs/api/request.md +3 -1
  14. data/documentation/docs/api/response.md +12 -1
  15. data/documentation/docs/api/route.md +67 -0
  16. data/documentation/docs/api/selectors.md +2 -2
  17. data/documentation/docs/api/tracing.md +1 -1
  18. data/documentation/docs/include/api_coverage.md +6 -3
  19. data/documentation/package.json +4 -4
  20. data/documentation/yarn.lock +1876 -1304
  21. data/lib/playwright/channel.rb +1 -3
  22. data/lib/playwright/channel_owners/browser.rb +13 -0
  23. data/lib/playwright/channel_owners/browser_context.rb +81 -13
  24. data/lib/playwright/channel_owners/browser_type.rb +4 -0
  25. data/lib/playwright/channel_owners/frame.rb +16 -2
  26. data/lib/playwright/channel_owners/local_utils.rb +29 -0
  27. data/lib/playwright/channel_owners/page.rb +43 -15
  28. data/lib/playwright/channel_owners/request.rb +31 -6
  29. data/lib/playwright/channel_owners/response.rb +6 -0
  30. data/lib/playwright/channel_owners/route.rb +104 -45
  31. data/lib/playwright/connection.rb +6 -1
  32. data/lib/playwright/har_router.rb +82 -0
  33. data/lib/playwright/http_headers.rb +1 -1
  34. data/lib/playwright/javascript/regex.rb +23 -0
  35. data/lib/playwright/javascript/value_parser.rb +21 -2
  36. data/lib/playwright/javascript/value_serializer.rb +18 -6
  37. data/lib/playwright/javascript/visitor_info.rb +26 -0
  38. data/lib/playwright/javascript.rb +1 -0
  39. data/lib/playwright/locator_impl.rb +13 -5
  40. data/lib/playwright/playwright_api.rb +26 -6
  41. data/lib/playwright/route_handler.rb +2 -6
  42. data/lib/playwright/utils.rb +31 -6
  43. data/lib/playwright/version.rb +2 -2
  44. data/lib/playwright.rb +2 -0
  45. data/lib/playwright_api/android.rb +8 -8
  46. data/lib/playwright_api/android_device.rb +11 -7
  47. data/lib/playwright_api/api_request_context.rb +6 -6
  48. data/lib/playwright_api/browser.rb +34 -8
  49. data/lib/playwright_api/browser_context.rb +21 -11
  50. data/lib/playwright_api/browser_type.rb +11 -7
  51. data/lib/playwright_api/cdp_session.rb +6 -6
  52. data/lib/playwright_api/console_message.rb +6 -6
  53. data/lib/playwright_api/dialog.rb +6 -6
  54. data/lib/playwright_api/download.rb +1 -1
  55. data/lib/playwright_api/element_handle.rb +26 -24
  56. data/lib/playwright_api/file_chooser.rb +2 -2
  57. data/lib/playwright_api/frame.rb +18 -11
  58. data/lib/playwright_api/js_handle.rb +6 -6
  59. data/lib/playwright_api/locator.rb +38 -19
  60. data/lib/playwright_api/page.rb +33 -16
  61. data/lib/playwright_api/playwright.rb +8 -8
  62. data/lib/playwright_api/request.rb +14 -7
  63. data/lib/playwright_api/response.rb +20 -7
  64. data/lib/playwright_api/route.rb +69 -8
  65. data/lib/playwright_api/selectors.rb +7 -7
  66. data/lib/playwright_api/tracing.rb +7 -7
  67. data/lib/playwright_api/web_socket.rb +6 -6
  68. data/lib/playwright_api/worker.rb +8 -8
  69. metadata +6 -4
  70. data/lib/playwright_api/local_utils.rb +0 -9
@@ -24,6 +24,8 @@ module Playwright
24
24
  @remote = false
25
25
  end
26
26
 
27
+ attr_reader :local_utils
28
+
27
29
  def mark_as_remote
28
30
  @remote = true
29
31
  end
@@ -127,12 +129,15 @@ module Playwright
127
129
  params = msg['params']
128
130
 
129
131
  if method == "__create__"
130
- create_remote_object(
132
+ remote_object = create_remote_object(
131
133
  parent_guid: guid,
132
134
  type: params["type"],
133
135
  guid: params["guid"],
134
136
  initializer: params["initializer"],
135
137
  )
138
+ if remote_object.is_a?(ChannelOwners::LocalUtils)
139
+ @local_utils = remote_object
140
+ end
136
141
  return
137
142
  end
138
143
 
@@ -0,0 +1,82 @@
1
+ module Playwright
2
+ class HarRouter
3
+ # @param local_utils [LocalUtils]
4
+ # @param file [String]
5
+ # @param not_found_action [String] 'abort' or 'fallback'
6
+ # @param url_match [String||Regexp|nil]
7
+ def self.create(local_utils, file, not_found_action, url_match: nil)
8
+ har_id = local_utils.har_open(file)
9
+
10
+ new(
11
+ local_utils: local_utils,
12
+ har_id: har_id,
13
+ not_found_action: not_found_action,
14
+ url_match: url_match,
15
+ )
16
+ end
17
+
18
+ # @param local_utils [LocalUtils]
19
+ # @param har_id [String]
20
+ # @param not_found_action [String] 'abort' or 'fallback'
21
+ # @param url_match [String||Regexp|nil]
22
+ def initialize(local_utils:, har_id:, not_found_action:, url_match: nil)
23
+ unless ['abort', 'fallback'].include?(not_found_action)
24
+ raise ArgumentError.new("not_found_action must be either 'abort' or 'fallback'. '#{not_found_action}' is specified.")
25
+ end
26
+
27
+ @local_utils = local_utils
28
+ @har_id = har_id
29
+ @not_found_action = not_found_action
30
+ @url_match = url_match || '**/*'
31
+ @debug = ENV['DEBUG'].to_s == 'true' || ENV['DEBUG'].to_s == '1'
32
+ end
33
+
34
+ private def handle(route, request)
35
+ response = @local_utils.har_lookup(
36
+ har_id: @har_id,
37
+ url: request.url,
38
+ method: request.method,
39
+ headers: request.headers_array,
40
+ post_data: request.post_data_buffer,
41
+ is_navigation_request: request.navigation_request?,
42
+ )
43
+ case response['action']
44
+ when 'redirect'
45
+ redirect_url = response['redirectURL']
46
+ puts "pw:api HAR: #{request.url} redirected to #{redirect_url}" if @debug
47
+ route.redirect_navigation_request(redirect_url)
48
+ when 'fulfill'
49
+ route.fulfill(
50
+ status: response['status'],
51
+ headers: response['headers'].map { |header| [header['name'], header['value']] }.to_h,
52
+ body: Base64.strict_decode64(response['body']),
53
+ )
54
+ else
55
+ # Report the error, but fall through to the default handler.
56
+ if response['action'] == 'error'
57
+ puts "pw:api HAR: #{response['message']} redirected to #{redirect_url}" if @debug
58
+ end
59
+
60
+ if @not_found_action == 'abort'
61
+ route.abort
62
+ else
63
+ route.fallback
64
+ end
65
+ end
66
+ end
67
+
68
+ def add_context_route(context)
69
+ context.route(@url_match, method(:handle))
70
+ context.once(Events::BrowserContext::Close, method(:dispose))
71
+ end
72
+
73
+ def add_page_route(page)
74
+ page.route(@url_match, method(:handle))
75
+ page.once(Events::Page::Close, method(:dispose))
76
+ end
77
+
78
+ def dispose
79
+ @local_utils.async_har_close(@har_id)
80
+ end
81
+ end
82
+ end
@@ -7,7 +7,7 @@ module Playwright
7
7
 
8
8
  def as_serialized
9
9
  @headers.map do |key, value|
10
- { name: key, value: value }
10
+ { 'name' => key, 'value' => value }
11
11
  end
12
12
  end
13
13
  end
@@ -0,0 +1,23 @@
1
+ module Playwright
2
+ module JavaScript
3
+ class Regex
4
+ def initialize(regexp)
5
+ unless regexp.is_a?(Regexp)
6
+ raise ArgumentError("Argument must be a Regexp: #{regexp} (#{regexp.class})")
7
+ end
8
+
9
+ @source = regexp.source
10
+ @flag = flag_for(regexp)
11
+ end
12
+
13
+ attr_reader :source, :flag
14
+
15
+ private def flag_for(regexp)
16
+ flags = []
17
+ flags << 'ms' if (regexp.options & Regexp::MULTILINE) != 0
18
+ flags << 'i' if (regexp.options & Regexp::IGNORECASE) != 0
19
+ flags.join('')
20
+ end
21
+ end
22
+ end
23
+ end
@@ -5,6 +5,7 @@ module Playwright
5
5
  class ValueParser
6
6
  def initialize(hash)
7
7
  @hash = hash
8
+ @refs = {}
8
9
  end
9
10
 
10
11
  # @return [Hash]
@@ -23,6 +24,10 @@ module Playwright
23
24
  return hash[key] if hash.key?(key)
24
25
  end
25
26
 
27
+ if hash.key?('ref')
28
+ return @refs[hash['ref']]
29
+ end
30
+
26
31
  if hash.key?('v')
27
32
  return case hash['v']
28
33
  when 'undefined'
@@ -43,6 +48,10 @@ module Playwright
43
48
  return DateTime.parse(hash['d'])
44
49
  end
45
50
 
51
+ if hash.key?('u')
52
+ return URI(hash['u'])
53
+ end
54
+
46
55
  if hash.key?('r')
47
56
  # @see https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/RegExp
48
57
  # @see https://docs.ruby-lang.org/ja/latest/class/Regexp.html
@@ -55,11 +64,21 @@ module Playwright
55
64
  end
56
65
 
57
66
  if hash.key?('a')
58
- return hash['a'].map { |value| parse_hash(value) }
67
+ result = []
68
+ if hash['id']
69
+ @refs[hash['id']] = result
70
+ end
71
+ hash['a'].each { |value| result << parse_hash(value) }
72
+ return result
59
73
  end
60
74
 
61
75
  if hash.key?('o')
62
- return hash['o'].map { |obj| [obj['k'], parse_hash(obj['v'])] }.to_h
76
+ result = {}
77
+ if hash['id']
78
+ @refs[hash['id']] = result
79
+ end
80
+ hash['o'].each { |obj| result[obj['k']] = parse_hash(obj['v']) }
81
+ return result
63
82
  end
64
83
 
65
84
  if hash.key?('h')
@@ -1,8 +1,12 @@
1
+ require_relative './visitor_info'
2
+ require_relative './regex'
3
+
1
4
  module Playwright
2
5
  module JavaScript
3
6
  class ValueSerializer
4
7
  def initialize(ruby_value)
5
8
  @value = ruby_value
9
+ @visited = VisitorInfo.new
6
10
  end
7
11
 
8
12
  # @return [Hash]
@@ -36,15 +40,23 @@ module Playwright
36
40
  when Time
37
41
  require 'time'
38
42
  { d: value.utc.iso8601 }
43
+ when URI
44
+ { u: value.to_s }
39
45
  when Regexp
40
- flags = []
41
- flags << 'ms' if (value.options & Regexp::MULTILINE) != 0
42
- flags << 'i' if (value.options & Regexp::IGNORECASE) != 0
43
- { r: { p: value.source, f: flags.join('') } }
46
+ regex_value = Regex.new(value)
47
+ { r: { p: regex_value.source, f: regex_value.flag } }
48
+ when -> (value) { @visited.ref(value) }
49
+ { ref: @visited.ref(value) }
44
50
  when Array
45
- { a: value.map { |v| serialize_value(v) } }
51
+ id = @visited.log(value)
52
+ result = []
53
+ value.each { |v| result << serialize_value(v) }
54
+ { a: result, id: id }
46
55
  when Hash
47
- { o: value.map { |key, v| { k: key, v: serialize_value(v) } } }
56
+ id = @visited.log(value)
57
+ result = []
58
+ value.each { |key, v| result << { k: key, v: serialize_value(v) } }
59
+ { o: result, id: id }
48
60
  else
49
61
  raise ArgumentError.new("Unexpected value: #{value}")
50
62
  end
@@ -0,0 +1,26 @@
1
+ module Playwright
2
+ module JavaScript
3
+ class VisitorInfo
4
+ def initialize
5
+ @data = {}
6
+ @last_id = 0
7
+ end
8
+
9
+ # returns [Integer|nil]
10
+ def ref(object)
11
+ @data[object]
12
+ end
13
+
14
+ def log(object)
15
+ if @data[object]
16
+ raise ArgumentError.new("Already visited")
17
+ end
18
+
19
+ id = @last_id + 1
20
+ @last_id = id # FIXME: should thread-safe
21
+
22
+ @data[object] = id
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,4 @@
1
1
  require_relative './javascript/expression'
2
2
  require_relative './javascript/value_parser'
3
3
  require_relative './javascript/value_serializer'
4
+ require_relative './javascript/regex'
@@ -31,11 +31,9 @@ module Playwright
31
31
 
32
32
  case hasText
33
33
  when Regexp
34
- source = EscapeWithQuotes.new(hasText.source, '"')
35
- flags = []
36
- flags << 'ms' if (hasText.options & Regexp::MULTILINE) != 0
37
- flags << 'i' if (hasText.options & Regexp::IGNORECASE) != 0
38
- selector_scopes << ":scope:text-matches(#{source}, \"#{flags.join('')}\")"
34
+ regex = JavaScript::Regex.new(hasText)
35
+ source = EscapeWithQuotes.new(regex.source, '"')
36
+ selector_scopes << "has=#{"text=/#{regex.source}/#{regex.flag}".to_json}"
39
37
  when String
40
38
  text = EscapeWithQuotes.new(hasText, '"')
41
39
  selector_scopes << ":scope:has-text(#{text})"
@@ -239,6 +237,16 @@ module Playwright
239
237
  @frame.query_selector_all(@selector)
240
238
  end
241
239
 
240
+ def filter(has: nil, hasText: nil)
241
+ LocatorImpl.new(
242
+ frame: @frame,
243
+ timeout_settings: @timeout_settings,
244
+ selector: @selector,
245
+ hasText: hasText,
246
+ has: has,
247
+ )
248
+ end
249
+
242
250
  def first
243
251
  LocatorImpl.new(
244
252
  frame: @frame,
@@ -122,21 +122,41 @@ module Playwright
122
122
  }
123
123
  end
124
124
 
125
- private def wrap_impl(object)
125
+ private def wrap_impl(object, visited: {})
126
126
  if object.is_a?(Array)
127
- object.map { |obj| wrap_impl(obj) }
127
+ unless visited[object]
128
+ visited[object] = []
129
+ object.each { |obj| visited[object] << wrap_impl(obj) }
130
+ end
131
+ visited[object]
128
132
  elsif object.is_a?(Hash)
129
- object.map { |key, obj| [key, wrap_impl(obj)] }.to_h
133
+ unless visited[object]
134
+ visited[object] = {}
135
+ object.each do |key, obj|
136
+ visited[object][key] = wrap_impl(obj, visited: visited)
137
+ end
138
+ end
139
+ visited[object]
130
140
  else
131
141
  ::Playwright::PlaywrightApi.wrap(object)
132
142
  end
133
143
  end
134
144
 
135
- private def unwrap_impl(object)
145
+ private def unwrap_impl(object, visited: {})
136
146
  if object.is_a?(Array)
137
- object.map { |obj| unwrap_impl(obj) }
147
+ unless visited[object]
148
+ visited[object] = []
149
+ object.each { |obj| visited[object] << unwrap_impl(obj) }
150
+ end
151
+ visited[object]
138
152
  elsif object.is_a?(Hash)
139
- object.map { |key, obj| [key, unwrap_impl(obj)] }.to_h
153
+ unless visited[object]
154
+ visited[object] = {}
155
+ object.each do |key, obj|
156
+ visited[object][key] = unwrap_impl(obj, visited: visited)
157
+ end
158
+ end
159
+ visited[object]
140
160
  elsif object.is_a?(PlaywrightApi)
141
161
  ::Playwright::PlaywrightApi.unwrap(object)
142
162
  else
@@ -50,12 +50,8 @@ module Playwright
50
50
  def async_handle(route, request)
51
51
  @counter.increment
52
52
 
53
- Concurrent::Promises.future do
54
- begin
55
- @handler.call(route, request)
56
- rescue => err
57
- puts err, err.backtrace
58
- end
53
+ Concurrent::Promises.future { @handler.call(route, request) }.rescue do |err|
54
+ puts err, err.backtrace
59
55
  end
60
56
  end
61
57
 
@@ -1,6 +1,36 @@
1
1
  module Playwright
2
2
  module Utils
3
3
  module PrepareBrowserContextOptions
4
+ private def prepare_record_har_options(params)
5
+ out_params = {
6
+ path: params.delete(:record_har_path)
7
+ }
8
+ if params[:record_har_url_filter]
9
+ opt = params.delete(:record_har_url_filter)
10
+ if opt.is_a?(Regexp)
11
+ regex = ::Playwright::JavaScript::Regex.new(opt)
12
+ out_params[:urlRegexSource] = regex.source
13
+ out_params[:urlRegexFlags] = regex.flag
14
+ elsif opt.is_a?(String)
15
+ out_params[:urlGlob] = opt
16
+ end
17
+ end
18
+ if params[:record_har_mode]
19
+ out_params[:mode] = params.delete(:record_har_mode)
20
+ end
21
+ if params[:record_har_content]
22
+ out_params[:content] = params.delete(:record_har_content)
23
+ end
24
+ if params[:record_har_omit_content]
25
+ old_api_omit_content = params.delete(:record_har_omit_content)
26
+ if old_api_omit_content
27
+ out_params[:content] ||= 'omit'
28
+ end
29
+ end
30
+
31
+ out_params
32
+ end
33
+
4
34
  # @see https://github.com/microsoft/playwright/blob/5a2cfdbd47ed3c3deff77bb73e5fac34241f649d/src/client/browserContext.ts#L265
5
35
  private def prepare_browser_context_options(params)
6
36
  if params[:noViewport] == 0
@@ -11,12 +41,7 @@ module Playwright
11
41
  params[:extraHTTPHeaders] = ::Playwright::HttpHeaders.new(params[:extraHTTPHeaders]).as_serialized
12
42
  end
13
43
  if params[:record_har_path]
14
- params[:recordHar] = {
15
- path: params.delete(:record_har_path)
16
- }
17
- if params[:record_har_omit_content]
18
- params[:recordHar][:omitContent] = params.delete(:record_har_omit_content)
19
- end
44
+ params[:recordHar] = prepare_record_har_options(params)
20
45
  end
21
46
  if params[:record_video_dir]
22
47
  params[:recordVideo] = {
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.21.0'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.21.1'
4
+ VERSION = '1.24.0'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.24.2'
6
6
  end
data/lib/playwright.rb CHANGED
@@ -20,6 +20,7 @@ require 'playwright/channel_owner'
20
20
  require 'playwright/http_headers'
21
21
  require 'playwright/input_files'
22
22
  require 'playwright/connection'
23
+ require 'playwright/har_router'
23
24
  require 'playwright/raw_headers'
24
25
  require 'playwright/route_handler'
25
26
  require 'playwright/select_option_values'
@@ -143,6 +144,7 @@ module Playwright
143
144
  playwright = connection.initialize_playwright
144
145
  browser = playwright.send(:pre_launched_browser)
145
146
  browser.should_close_connection_on_close!
147
+ browser.send(:update_browser_type, browser.browser_type)
146
148
  Execution.new(connection, PlaywrightApi.wrap(playwright), PlaywrightApi.wrap(browser))
147
149
  rescue
148
150
  connection.stop
@@ -26,8 +26,8 @@ module Playwright
26
26
  class Android < PlaywrightApi
27
27
 
28
28
  # Returns the list of detected Android devices.
29
- def devices(omitDriverInstall: nil, port: nil)
30
- wrap_impl(@impl.devices(omitDriverInstall: unwrap_impl(omitDriverInstall), port: unwrap_impl(port)))
29
+ def devices(host: nil, omitDriverInstall: nil, port: nil)
30
+ wrap_impl(@impl.devices(host: unwrap_impl(host), omitDriverInstall: unwrap_impl(omitDriverInstall), port: unwrap_impl(port)))
31
31
  end
32
32
 
33
33
  # This setting will change the default maximum time for all the methods accepting `timeout` option.
@@ -38,20 +38,20 @@ module Playwright
38
38
 
39
39
  # -- inherited from EventEmitter --
40
40
  # @nodoc
41
- def once(event, callback)
42
- event_emitter_proxy.once(event, callback)
41
+ def off(event, callback)
42
+ event_emitter_proxy.off(event, callback)
43
43
  end
44
44
 
45
45
  # -- inherited from EventEmitter --
46
46
  # @nodoc
47
- def on(event, callback)
48
- event_emitter_proxy.on(event, callback)
47
+ def once(event, callback)
48
+ event_emitter_proxy.once(event, callback)
49
49
  end
50
50
 
51
51
  # -- inherited from EventEmitter --
52
52
  # @nodoc
53
- def off(event, callback)
54
- event_emitter_proxy.off(event, callback)
53
+ def on(event, callback)
54
+ event_emitter_proxy.on(event, callback)
55
55
  end
56
56
 
57
57
  private def event_emitter_proxy
@@ -57,18 +57,22 @@ module Playwright
57
57
  noViewport: nil,
58
58
  offline: nil,
59
59
  permissions: nil,
60
+ record_har_content: nil,
61
+ record_har_mode: nil,
60
62
  record_har_omit_content: nil,
61
63
  record_har_path: nil,
64
+ record_har_url_filter: nil,
62
65
  record_video_dir: nil,
63
66
  record_video_size: nil,
64
67
  reducedMotion: nil,
65
68
  screen: nil,
69
+ serviceWorkers: nil,
66
70
  strictSelectors: nil,
67
71
  timezoneId: nil,
68
72
  userAgent: nil,
69
73
  viewport: nil,
70
74
  &block)
71
- wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), command: unwrap_impl(command), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
75
+ wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), command: unwrap_impl(command), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(permissions), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
72
76
  end
73
77
 
74
78
  # Performs a long tap on the widget defined by `selector`.
@@ -171,20 +175,20 @@ module Playwright
171
175
 
172
176
  # -- inherited from EventEmitter --
173
177
  # @nodoc
174
- def once(event, callback)
175
- event_emitter_proxy.once(event, callback)
178
+ def off(event, callback)
179
+ event_emitter_proxy.off(event, callback)
176
180
  end
177
181
 
178
182
  # -- inherited from EventEmitter --
179
183
  # @nodoc
180
- def on(event, callback)
181
- event_emitter_proxy.on(event, callback)
184
+ def once(event, callback)
185
+ event_emitter_proxy.once(event, callback)
182
186
  end
183
187
 
184
188
  # -- inherited from EventEmitter --
185
189
  # @nodoc
186
- def off(event, callback)
187
- event_emitter_proxy.off(event, callback)
190
+ def on(event, callback)
191
+ event_emitter_proxy.on(event, callback)
188
192
  end
189
193
 
190
194
  private def event_emitter_proxy
@@ -186,20 +186,20 @@ module Playwright
186
186
 
187
187
  # -- inherited from EventEmitter --
188
188
  # @nodoc
189
- def once(event, callback)
190
- event_emitter_proxy.once(event, callback)
189
+ def off(event, callback)
190
+ event_emitter_proxy.off(event, callback)
191
191
  end
192
192
 
193
193
  # -- inherited from EventEmitter --
194
194
  # @nodoc
195
- def on(event, callback)
196
- event_emitter_proxy.on(event, callback)
195
+ def once(event, callback)
196
+ event_emitter_proxy.once(event, callback)
197
197
  end
198
198
 
199
199
  # -- inherited from EventEmitter --
200
200
  # @nodoc
201
- def off(event, callback)
202
- event_emitter_proxy.off(event, callback)
201
+ def on(event, callback)
202
+ event_emitter_proxy.on(event, callback)
203
203
  end
204
204
 
205
205
  private def event_emitter_proxy