playwright-ruby-client 1.20.2 → 1.23.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.
- checksums.yaml +4 -4
- data/documentation/docs/api/api_request_context.md +15 -2
- data/documentation/docs/api/browser.md +16 -0
- data/documentation/docs/api/browser_context.md +15 -2
- data/documentation/docs/api/browser_type.md +5 -1
- data/documentation/docs/api/console_message.md +27 -1
- data/documentation/docs/api/element_handle.md +23 -13
- data/documentation/docs/api/experimental/android.md +1 -1
- data/documentation/docs/api/experimental/android_device.md +4 -0
- data/documentation/docs/api/file_chooser.md +1 -1
- data/documentation/docs/api/frame.md +12 -5
- data/documentation/docs/api/frame_locator.md +1 -1
- data/documentation/docs/api/locator.md +44 -13
- data/documentation/docs/api/page.md +32 -9
- data/documentation/docs/api/request.md +3 -1
- data/documentation/docs/api/response.md +12 -1
- data/documentation/docs/api/route.md +67 -0
- data/documentation/docs/include/api_coverage.md +6 -3
- data/documentation/package.json +6 -6
- data/documentation/yarn.lock +2931 -3220
- data/lib/playwright/channel.rb +1 -3
- data/lib/playwright/channel_owners/browser.rb +13 -0
- data/lib/playwright/channel_owners/browser_context.rb +89 -13
- data/lib/playwright/channel_owners/browser_type.rb +4 -0
- data/lib/playwright/channel_owners/element_handle.rb +12 -3
- data/lib/playwright/channel_owners/frame.rb +20 -7
- data/lib/playwright/channel_owners/local_utils.rb +29 -0
- data/lib/playwright/channel_owners/page.rb +54 -22
- data/lib/playwright/channel_owners/request.rb +31 -6
- data/lib/playwright/channel_owners/response.rb +6 -0
- data/lib/playwright/channel_owners/route.rb +104 -45
- data/lib/playwright/channel_owners/writable_stream.rb +14 -0
- data/lib/playwright/connection.rb +6 -1
- data/lib/playwright/har_router.rb +82 -0
- data/lib/playwright/http_headers.rb +1 -1
- data/lib/playwright/input_files.rb +60 -8
- data/lib/playwright/javascript/regex.rb +23 -0
- data/lib/playwright/javascript/value_parser.rb +17 -2
- data/lib/playwright/javascript/value_serializer.rb +16 -6
- data/lib/playwright/javascript/visitor_info.rb +26 -0
- data/lib/playwright/javascript.rb +1 -0
- data/lib/playwright/locator_impl.rb +18 -5
- data/lib/playwright/playwright_api.rb +26 -6
- data/lib/playwright/route_handler.rb +2 -6
- data/lib/playwright/transport.rb +12 -2
- data/lib/playwright/utils.rb +31 -6
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright.rb +2 -0
- data/lib/playwright_api/accessibility.rb +2 -1
- data/lib/playwright_api/android.rb +2 -2
- data/lib/playwright_api/android_device.rb +5 -1
- data/lib/playwright_api/api_request.rb +3 -3
- data/lib/playwright_api/api_request_context.rb +15 -2
- data/lib/playwright_api/browser.rb +15 -2
- data/lib/playwright_api/browser_context.rb +17 -7
- data/lib/playwright_api/browser_type.rb +7 -3
- data/lib/playwright_api/console_message.rb +20 -1
- data/lib/playwright_api/element_handle.rb +53 -49
- data/lib/playwright_api/file_chooser.rb +1 -1
- data/lib/playwright_api/frame.rb +30 -23
- data/lib/playwright_api/frame_locator.rb +1 -1
- data/lib/playwright_api/locator.rb +58 -38
- data/lib/playwright_api/page.rb +52 -32
- data/lib/playwright_api/playwright.rb +1 -1
- data/lib/playwright_api/request.rb +8 -1
- data/lib/playwright_api/response.rb +14 -1
- data/lib/playwright_api/route.rb +63 -2
- data/lib/playwright_api/selectors.rb +1 -1
- data/lib/playwright_api/tracing.rb +1 -1
- metadata +7 -4
- data/lib/playwright_api/local_utils.rb +0 -9
    
        data/lib/playwright/transport.rb
    CHANGED
    
    | @@ -110,12 +110,22 @@ module Playwright | |
| 110 110 |  | 
| 111 111 | 
             
                def debug_send_message(message)
         | 
| 112 112 | 
             
                  metadata = message.delete(:metadata)
         | 
| 113 | 
            -
                  puts "\x1b[33mSEND>\x1b[0m#{message}"
         | 
| 113 | 
            +
                  puts "\x1b[33mSEND>\x1b[0m#{shorten_double_quoted_string(message)}"
         | 
| 114 114 | 
             
                  message[:metadata] = metadata
         | 
| 115 115 | 
             
                end
         | 
| 116 116 |  | 
| 117 117 | 
             
                def debug_recv_message(message)
         | 
| 118 | 
            -
                  puts "\x1b[33mRECV>\x1b[0m#{message}"
         | 
| 118 | 
            +
                  puts "\x1b[33mRECV>\x1b[0m#{shorten_double_quoted_string(message)}"
         | 
| 119 | 
            +
                end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                def shorten_double_quoted_string(message, maxlen: 512)
         | 
| 122 | 
            +
                  message.to_s.gsub(/"([^"]+)"/) do |str|
         | 
| 123 | 
            +
                    if $1.length > maxlen
         | 
| 124 | 
            +
                      "\"#{$1[0...maxlen]}...\""
         | 
| 125 | 
            +
                    else
         | 
| 126 | 
            +
                      str
         | 
| 127 | 
            +
                    end
         | 
| 128 | 
            +
                  end
         | 
| 119 129 | 
             
                end
         | 
| 120 130 | 
             
              end
         | 
| 121 131 | 
             
            end
         | 
    
        data/lib/playwright/utils.rb
    CHANGED
    
    | @@ -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] = {
         | 
    
        data/lib/playwright/version.rb
    CHANGED
    
    
    
        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
         | 
| @@ -35,7 +35,8 @@ module Playwright | |
| 35 35 | 
             
                #         return node
         | 
| 36 36 | 
             
                #     for child in (node.get("children") or []):
         | 
| 37 37 | 
             
                #         found_node = find_focused_node(child)
         | 
| 38 | 
            -
                #          | 
| 38 | 
            +
                #         if (found_node)
         | 
| 39 | 
            +
                #             return found_node
         | 
| 39 40 | 
             
                #     return None
         | 
| 40 41 | 
             
                #
         | 
| 41 42 | 
             
                # snapshot = page.accessibility.snapshot()
         | 
| @@ -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(port: nil)
         | 
| 30 | 
            -
                  wrap_impl(@impl.devices(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.
         | 
| @@ -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`.
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            module Playwright
         | 
| 2 | 
            -
              # Exposes API that can be used for the Web API testing.  | 
| 3 | 
            -
              #  | 
| 4 | 
            -
              #  | 
| 2 | 
            +
              # Exposes API that can be used for the Web API testing. This class is used for creating `APIRequestContext` instance which
         | 
| 3 | 
            +
              # in turn can be used for sending web requests. An instance of this class can be obtained via
         | 
| 4 | 
            +
              # [`property: Playwright.request`]. For more information see `APIRequestContext`.
         | 
| 5 5 | 
             
              class APIRequest < PlaywrightApi
         | 
| 6 6 |  | 
| 7 7 | 
             
                # Creates new instances of `APIRequestContext`.
         | 
| @@ -1,9 +1,22 @@ | |
| 1 1 | 
             
            module Playwright
         | 
| 2 2 | 
             
              # This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
         | 
| 3 | 
            -
              # environment or the service to your e2e test. | 
| 4 | 
            -
              # | 
| 3 | 
            +
              # environment or the service to your e2e test.
         | 
| 4 | 
            +
              #
         | 
| 5 | 
            +
              # Each Playwright browser context has associated with it `APIRequestContext` instance which shares cookie storage with the
         | 
| 6 | 
            +
              # browser context and can be accessed via [`property: BrowserContext.request`] or [`property: Page.request`]. It is also
         | 
| 7 | 
            +
              # possible to create a new APIRequestContext instance manually by calling [`method: APIRequest.newContext`].
         | 
| 8 | 
            +
              #
         | 
| 9 | 
            +
              # **Cookie management**
         | 
| 10 | 
            +
              #
         | 
| 11 | 
            +
              # `APIRequestContext` retuned by [`property: BrowserContext.request`] and [`property: Page.request`] shares cookie storage
         | 
| 12 | 
            +
              # with the corresponding `BrowserContext`. Each API request will have `Cookie` header populated with the values from the
         | 
| 13 | 
            +
              # browser context. If the API response contains `Set-Cookie` header it will automatically update `BrowserContext` cookies
         | 
| 14 | 
            +
              # and requests made from the page will pick them up. This means that if you log in using this API, your e2e test will be
         | 
| 5 15 | 
             
              # logged in and vice versa.
         | 
| 6 16 | 
             
              #
         | 
| 17 | 
            +
              # If you want API requests to not interfere with the browser cookies you shoud create a new `APIRequestContext` by calling
         | 
| 18 | 
            +
              # [`method: APIRequest.newContext`]. Such `APIRequestContext` object will have its own isolated cookie storage.
         | 
| 19 | 
            +
              #
         | 
| 7 20 | 
             
              # ```python sync
         | 
| 8 21 | 
             
              # import os
         | 
| 9 22 | 
             
              # from playwright.sync_api import sync_playwright
         | 
| @@ -18,6 +18,11 @@ module Playwright | |
| 18 18 | 
             
              # ```
         | 
| 19 19 | 
             
              class Browser < PlaywrightApi
         | 
| 20 20 |  | 
| 21 | 
            +
                # Get the browser type (chromium, firefox or webkit) that the browser belongs to.
         | 
| 22 | 
            +
                def browser_type
         | 
| 23 | 
            +
                  wrap_impl(@impl.browser_type)
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 21 26 | 
             
                # In case this browser is obtained using [`method: BrowserType.launch`], closes the browser and all of its pages (if any
         | 
| 22 27 | 
             
                # were opened).
         | 
| 23 28 | 
             
                #
         | 
| @@ -82,19 +87,23 @@ module Playwright | |
| 82 87 | 
             
                      offline: nil,
         | 
| 83 88 | 
             
                      permissions: nil,
         | 
| 84 89 | 
             
                      proxy: nil,
         | 
| 90 | 
            +
                      record_har_content: nil,
         | 
| 91 | 
            +
                      record_har_mode: nil,
         | 
| 85 92 | 
             
                      record_har_omit_content: nil,
         | 
| 86 93 | 
             
                      record_har_path: nil,
         | 
| 94 | 
            +
                      record_har_url_filter: nil,
         | 
| 87 95 | 
             
                      record_video_dir: nil,
         | 
| 88 96 | 
             
                      record_video_size: nil,
         | 
| 89 97 | 
             
                      reducedMotion: nil,
         | 
| 90 98 | 
             
                      screen: nil,
         | 
| 99 | 
            +
                      serviceWorkers: nil,
         | 
| 91 100 | 
             
                      storageState: nil,
         | 
| 92 101 | 
             
                      strictSelectors: nil,
         | 
| 93 102 | 
             
                      timezoneId: nil,
         | 
| 94 103 | 
             
                      userAgent: nil,
         | 
| 95 104 | 
             
                      viewport: nil,
         | 
| 96 105 | 
             
                      &block)
         | 
| 97 | 
            -
                  wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), 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), proxy: unwrap_impl(proxy), 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), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
         | 
| 106 | 
            +
                  wrap_impl(@impl.new_context(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), 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), proxy: unwrap_impl(proxy), 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), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
         | 
| 98 107 | 
             
                end
         | 
| 99 108 |  | 
| 100 109 | 
             
                # Creates a new page in a new browser context. Closing this page will close the context as well.
         | 
| @@ -121,19 +130,23 @@ module Playwright | |
| 121 130 | 
             
                      offline: nil,
         | 
| 122 131 | 
             
                      permissions: nil,
         | 
| 123 132 | 
             
                      proxy: nil,
         | 
| 133 | 
            +
                      record_har_content: nil,
         | 
| 134 | 
            +
                      record_har_mode: nil,
         | 
| 124 135 | 
             
                      record_har_omit_content: nil,
         | 
| 125 136 | 
             
                      record_har_path: nil,
         | 
| 137 | 
            +
                      record_har_url_filter: nil,
         | 
| 126 138 | 
             
                      record_video_dir: nil,
         | 
| 127 139 | 
             
                      record_video_size: nil,
         | 
| 128 140 | 
             
                      reducedMotion: nil,
         | 
| 129 141 | 
             
                      screen: nil,
         | 
| 142 | 
            +
                      serviceWorkers: nil,
         | 
| 130 143 | 
             
                      storageState: nil,
         | 
| 131 144 | 
             
                      strictSelectors: nil,
         | 
| 132 145 | 
             
                      timezoneId: nil,
         | 
| 133 146 | 
             
                      userAgent: nil,
         | 
| 134 147 | 
             
                      viewport: nil,
         | 
| 135 148 | 
             
                      &block)
         | 
| 136 | 
            -
                  wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), 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), proxy: unwrap_impl(proxy), 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), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
         | 
| 149 | 
            +
                  wrap_impl(@impl.new_page(acceptDownloads: unwrap_impl(acceptDownloads), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), 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), proxy: unwrap_impl(proxy), 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), storageState: unwrap_impl(storageState), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
         | 
| 137 150 | 
             
                end
         | 
| 138 151 |  | 
| 139 152 | 
             
                # > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
         | 
| @@ -225,9 +225,9 @@ module Playwright | |
| 225 225 | 
             
                # Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
         | 
| 226 226 | 
             
                # is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
         | 
| 227 227 | 
             
                #
         | 
| 228 | 
            -
                # > NOTE: [`method:  | 
| 228 | 
            +
                # > NOTE: [`method: BrowserContext.route`] will not intercept requests intercepted by Service Worker. See
         | 
| 229 229 | 
             
                # [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
         | 
| 230 | 
            -
                # request interception | 
| 230 | 
            +
                # request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
         | 
| 231 231 | 
             
                #
         | 
| 232 232 | 
             
                # An example of a naive handler that aborts all image requests:
         | 
| 233 233 | 
             
                #
         | 
| @@ -273,6 +273,16 @@ module Playwright | |
| 273 273 | 
             
                  wrap_impl(@impl.route(unwrap_impl(url), unwrap_impl(handler), times: unwrap_impl(times)))
         | 
| 274 274 | 
             
                end
         | 
| 275 275 |  | 
| 276 | 
            +
                # If specified the network requests that are made in the context will be served from the HAR file. Read more about
         | 
| 277 | 
            +
                # [Replaying from HAR](../network.md#replaying-from-har).
         | 
| 278 | 
            +
                #
         | 
| 279 | 
            +
                # Playwright will not serve requests intercepted by Service Worker from the HAR file. See
         | 
| 280 | 
            +
                # [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
         | 
| 281 | 
            +
                # request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
         | 
| 282 | 
            +
                def route_from_har(har, notFound: nil, update: nil, url: nil)
         | 
| 283 | 
            +
                  wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), url: unwrap_impl(url)))
         | 
| 284 | 
            +
                end
         | 
| 285 | 
            +
             | 
| 276 286 | 
             
                # > NOTE: Service workers are only supported on Chromium-based browsers.
         | 
| 277 287 | 
             
                #
         | 
| 278 288 | 
             
                # All existing service workers in the context.
         | 
| @@ -376,6 +386,11 @@ module Playwright | |
| 376 386 | 
             
                  wrap_impl(@impl.pause)
         | 
| 377 387 | 
             
                end
         | 
| 378 388 |  | 
| 389 | 
            +
                # @nodoc
         | 
| 390 | 
            +
                def options=(req)
         | 
| 391 | 
            +
                  wrap_impl(@impl.options=(unwrap_impl(req)))
         | 
| 392 | 
            +
                end
         | 
| 393 | 
            +
             | 
| 379 394 | 
             
                # @nodoc
         | 
| 380 395 | 
             
                def enable_debug_console!
         | 
| 381 396 | 
             
                  wrap_impl(@impl.enable_debug_console!)
         | 
| @@ -391,11 +406,6 @@ module Playwright | |
| 391 406 | 
             
                  wrap_impl(@impl.owner_page=(unwrap_impl(req)))
         | 
| 392 407 | 
             
                end
         | 
| 393 408 |  | 
| 394 | 
            -
                # @nodoc
         | 
| 395 | 
            -
                def options=(req)
         | 
| 396 | 
            -
                  wrap_impl(@impl.options=(unwrap_impl(req)))
         | 
| 397 | 
            -
                end
         | 
| 398 | 
            -
             | 
| 399 409 | 
             
                # -- inherited from EventEmitter --
         | 
| 400 410 | 
             
                # @nodoc
         | 
| 401 411 | 
             
                def off(event, callback)
         | 
| @@ -18,12 +18,12 @@ module Playwright | |
| 18 18 | 
             
              # ```
         | 
| 19 19 | 
             
              class BrowserType < PlaywrightApi
         | 
| 20 20 |  | 
| 21 | 
            -
                # This  | 
| 21 | 
            +
                # This method attaches Playwright to an existing browser instance.
         | 
| 22 22 | 
             
                def connect(wsEndpoint, headers: nil, slowMo: nil, timeout: nil)
         | 
| 23 23 | 
             
                  raise NotImplementedError.new('connect is not implemented yet.')
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| 26 | 
            -
                # This  | 
| 26 | 
            +
                # This method attaches Playwright to an existing browser instance using the Chrome DevTools Protocol.
         | 
| 27 27 | 
             
                #
         | 
| 28 28 | 
             
                # The default browser context is accessible via [`method: Browser.contexts`].
         | 
| 29 29 | 
             
                #
         | 
| @@ -124,12 +124,16 @@ module Playwright | |
| 124 124 | 
             
                      offline: nil,
         | 
| 125 125 | 
             
                      permissions: nil,
         | 
| 126 126 | 
             
                      proxy: nil,
         | 
| 127 | 
            +
                      record_har_content: nil,
         | 
| 128 | 
            +
                      record_har_mode: nil,
         | 
| 127 129 | 
             
                      record_har_omit_content: nil,
         | 
| 128 130 | 
             
                      record_har_path: nil,
         | 
| 131 | 
            +
                      record_har_url_filter: nil,
         | 
| 129 132 | 
             
                      record_video_dir: nil,
         | 
| 130 133 | 
             
                      record_video_size: nil,
         | 
| 131 134 | 
             
                      reducedMotion: nil,
         | 
| 132 135 | 
             
                      screen: nil,
         | 
| 136 | 
            +
                      serviceWorkers: nil,
         | 
| 133 137 | 
             
                      slowMo: nil,
         | 
| 134 138 | 
             
                      strictSelectors: nil,
         | 
| 135 139 | 
             
                      timeout: nil,
         | 
| @@ -138,7 +142,7 @@ module Playwright | |
| 138 142 | 
             
                      userAgent: nil,
         | 
| 139 143 | 
             
                      viewport: nil,
         | 
| 140 144 | 
             
                      &block)
         | 
| 141 | 
            -
                  wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), 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), proxy: unwrap_impl(proxy), 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), slowMo: unwrap_impl(slowMo), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
         | 
| 145 | 
            +
                  wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), channel: unwrap_impl(channel), chromiumSandbox: unwrap_impl(chromiumSandbox), colorScheme: unwrap_impl(colorScheme), deviceScaleFactor: unwrap_impl(deviceScaleFactor), devtools: unwrap_impl(devtools), downloadsPath: unwrap_impl(downloadsPath), env: unwrap_impl(env), executablePath: unwrap_impl(executablePath), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), handleSIGHUP: unwrap_impl(handleSIGHUP), handleSIGINT: unwrap_impl(handleSIGINT), handleSIGTERM: unwrap_impl(handleSIGTERM), hasTouch: unwrap_impl(hasTouch), headless: unwrap_impl(headless), httpCredentials: unwrap_impl(httpCredentials), ignoreDefaultArgs: unwrap_impl(ignoreDefaultArgs), 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), proxy: unwrap_impl(proxy), 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), slowMo: unwrap_impl(slowMo), strictSelectors: unwrap_impl(strictSelectors), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
         | 
| 142 146 | 
             
                end
         | 
| 143 147 |  | 
| 144 148 | 
             
                # Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
         | 
| @@ -1,5 +1,24 @@ | |
| 1 1 | 
             
            module Playwright
         | 
| 2 | 
            -
              # `ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event.
         | 
| 2 | 
            +
              # `ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event. For each console messages logged
         | 
| 3 | 
            +
              # in the page there will be corresponding event in the Playwright context.
         | 
| 4 | 
            +
              #
         | 
| 5 | 
            +
              # ```python sync
         | 
| 6 | 
            +
              # # Listen for all console logs
         | 
| 7 | 
            +
              # page.on("console", lambda msg: print(msg.text))
         | 
| 8 | 
            +
              #
         | 
| 9 | 
            +
              # # Listen for all console events and handle errors
         | 
| 10 | 
            +
              # page.on("console", lambda msg: print(f"error: {msg.text}") if msg.type == "error" else None)
         | 
| 11 | 
            +
              #
         | 
| 12 | 
            +
              # # Get the next console log
         | 
| 13 | 
            +
              # with page.expect_console_message() as msg_info:
         | 
| 14 | 
            +
              #     # Issue console.log inside the page
         | 
| 15 | 
            +
              #     page.evaluate("console.log('hello', 42, { foo: 'bar' })")
         | 
| 16 | 
            +
              # msg = msg_info.value
         | 
| 17 | 
            +
              #
         | 
| 18 | 
            +
              # # Deconstruct print arguments
         | 
| 19 | 
            +
              # msg.args[0].json_value() # hello
         | 
| 20 | 
            +
              # msg.args[1].json_value() # 42
         | 
| 21 | 
            +
              # ```
         | 
| 3 22 | 
             
              class ConsoleMessage < PlaywrightApi
         | 
| 4 23 |  | 
| 5 24 | 
             
                # List of arguments passed to a `console` function call. See also [`event: Page.console`].
         |