playwright-ruby-client 1.14.beta2 → 1.14.beta3
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/accessibility.md +16 -17
- data/documentation/docs/api/experimental/android.md +15 -2
- data/documentation/docs/api/frame.md +55 -99
- data/documentation/docs/api/locator.md +2 -2
- data/documentation/docs/api/mouse.md +3 -4
- data/documentation/docs/api/request.md +15 -19
- data/documentation/docs/api/tracing.md +13 -12
- data/lib/playwright/channel_owners/request.rb +8 -8
- data/lib/playwright/locator_impl.rb +3 -3
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright_api/android.rb +15 -2
- data/lib/playwright_api/locator.rb +2 -2
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 88c8fbe4451b00ed8eba172f656e0171fb2580d555eefb4d2aa0cc1a13f86fc4
         | 
| 4 | 
            +
              data.tar.gz: 3d307147cc4a23356d561f9528ef95343984bf4623ad77ebb6e479ce4f4f9462
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 647702705f820c268e5b858a1cd587b0e8f32f16415df2fd7b91505a221cadc20400fc9f2db188964fe4759f4734c8b30bc15c265434d2ac2b78e0683228c192
         | 
| 7 | 
            +
              data.tar.gz: b4af0552e547d28be8c9390441bb7131d61fcea36fb5d3d293fd6985d6b47d3925e1c3bf27aa5f4e59243fc03ad751355acc20cb4e63b6e7489c47abb55b1864
         | 
| @@ -32,27 +32,26 @@ Playwright will discard them as well for an easier to process tree, unless `inte | |
| 32 32 |  | 
| 33 33 | 
             
            An example of dumping the entire accessibility tree:
         | 
| 34 34 |  | 
| 35 | 
            -
            ``` | 
| 36 | 
            -
            snapshot = page.accessibility.snapshot | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 35 | 
            +
            ```ruby
         | 
| 36 | 
            +
            snapshot = page.accessibility.snapshot
         | 
| 37 | 
            +
            puts snapshot
         | 
| 39 38 | 
             
            ```
         | 
| 40 39 |  | 
| 41 40 | 
             
            An example of logging the focused node's name:
         | 
| 42 41 |  | 
| 43 | 
            -
            ``` | 
| 44 | 
            -
            def find_focused_node(node) | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
                 | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 42 | 
            +
            ```ruby
         | 
| 43 | 
            +
            def find_focused_node(node)
         | 
| 44 | 
            +
              if node['focused']
         | 
| 45 | 
            +
                node
         | 
| 46 | 
            +
              else
         | 
| 47 | 
            +
                node['children']&.find do |child|
         | 
| 48 | 
            +
                  find_focused_node(child)
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
            end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            snapshot = page.accessibility.snapshot
         | 
| 53 54 | 
             
            node = find_focused_node(snapshot)
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                print(node["name"])
         | 
| 56 | 
            -
             | 
| 55 | 
            +
            puts node['name']
         | 
| 57 56 | 
             
            ```
         | 
| 58 57 |  | 
| @@ -4,8 +4,21 @@ sidebar_position: 10 | |
| 4 4 |  | 
| 5 5 | 
             
            # Android
         | 
| 6 6 |  | 
| 7 | 
            -
            Playwright has **experimental** support for Android automation.  | 
| 8 | 
            -
             | 
| 7 | 
            +
            Playwright has **experimental** support for Android automation. This includes Chrome for Android and Android WebView.
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            *Requirements*
         | 
| 10 | 
            +
            - Android device or AVD Emulator.
         | 
| 11 | 
            +
            - [ADB daemon](https://developer.android.com/studio/command-line/adb) running and authenticated with your device.
         | 
| 12 | 
            +
              Typically running `adb devices` is all you need to do.
         | 
| 13 | 
            +
            - [`Chrome 87`](https://play.google.com/store/apps/details?id=com.android.chrome) or newer installed on the device
         | 
| 14 | 
            +
            - "Enable command line on non-rooted devices" enabled in `chrome://flags`.
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            *Known limitations*
         | 
| 17 | 
            +
            - Raw USB operation is not yet supported, so you need ADB.
         | 
| 18 | 
            +
            - Device needs to be awake to produce screenshots. Enabling "Stay awake" developer mode will help.
         | 
| 19 | 
            +
            - We didn't run all the tests against the device, so not everything works.
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            *How to run*
         | 
| 9 22 |  | 
| 10 23 | 
             
            An example of the Android automation script would be:
         | 
| 11 24 |  | 
| @@ -16,25 +16,16 @@ At every point of time, page exposes its current frame tree via the [Page#main_f | |
| 16 16 |  | 
| 17 17 | 
             
            An example of dumping frame tree:
         | 
| 18 18 |  | 
| 19 | 
            -
            ``` | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
                 | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
                page.goto("https://www.theverge.com")
         | 
| 27 | 
            -
                dump_frame_tree(page.main_frame, "")
         | 
| 28 | 
            -
                browser.close()
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            def dump_frame_tree(frame, indent):
         | 
| 31 | 
            -
                print(indent + frame.name + '@' + frame.url)
         | 
| 32 | 
            -
                for child in frame.child_frames:
         | 
| 33 | 
            -
                    dump_frame_tree(child, indent + "    ")
         | 
| 34 | 
            -
             | 
| 35 | 
            -
            with sync_playwright() as playwright:
         | 
| 36 | 
            -
                run(playwright)
         | 
| 19 | 
            +
            ```ruby
         | 
| 20 | 
            +
            def dump_frame_tree(frame, indent = 0)
         | 
| 21 | 
            +
              puts "#{' ' * indent}#{frame.name}@#{frame.url}"
         | 
| 22 | 
            +
              frame.child_frames.each do |child|
         | 
| 23 | 
            +
                dump_frame_tree(child, indent + 2)
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
            end
         | 
| 37 26 |  | 
| 27 | 
            +
            page.goto("https://www.theverge.com")
         | 
| 28 | 
            +
            dump_frame_tree(page.main_frame)
         | 
| 38 29 | 
             
            ```
         | 
| 39 30 |  | 
| 40 31 |  | 
| @@ -176,9 +167,8 @@ The snippet below dispatches the `click` event on the element. Regardless of the | |
| 176 167 | 
             
            `click` is dispatched. This is equivalent to calling
         | 
| 177 168 | 
             
            [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
         | 
| 178 169 |  | 
| 179 | 
            -
            ``` | 
| 170 | 
            +
            ```ruby
         | 
| 180 171 | 
             
            frame.dispatch_event("button#submit", "click")
         | 
| 181 | 
            -
             | 
| 182 172 | 
             
            ```
         | 
| 183 173 |  | 
| 184 174 | 
             
            Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties
         | 
| @@ -195,11 +185,10 @@ Since `eventInit` is event-specific, please refer to the events documentation fo | |
| 195 185 |  | 
| 196 186 | 
             
            You can also specify [JSHandle](./js_handle) as the property value if you want live objects to be passed into the event:
         | 
| 197 187 |  | 
| 198 | 
            -
            ``` | 
| 188 | 
            +
            ```ruby
         | 
| 199 189 | 
             
            # note you can only create data_transfer in chromium and firefox
         | 
| 200 190 | 
             
            data_transfer = frame.evaluate_handle("new DataTransfer()")
         | 
| 201 | 
            -
            frame.dispatch_event("#source", "dragstart", {  | 
| 202 | 
            -
             | 
| 191 | 
            +
            frame.dispatch_event("#source", "dragstart", eventInit: { dataTransfer: data_transfer })
         | 
| 203 192 | 
             
            ```
         | 
| 204 193 |  | 
| 205 194 |  | 
| @@ -238,11 +227,10 @@ return its value. | |
| 238 227 |  | 
| 239 228 | 
             
            Examples:
         | 
| 240 229 |  | 
| 241 | 
            -
            ``` | 
| 230 | 
            +
            ```ruby
         | 
| 242 231 | 
             
            search_value = frame.eval_on_selector("#search", "el => el.value")
         | 
| 243 232 | 
             
            preload_href = frame.eval_on_selector("link[rel=preload]", "el => el.href")
         | 
| 244 | 
            -
            html = frame.eval_on_selector(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello")
         | 
| 245 | 
            -
             | 
| 233 | 
            +
            html = frame.eval_on_selector(".main-container", "(e, suffix) => e.outerHTML + suffix", arg: "hello")
         | 
| 246 234 | 
             
            ```
         | 
| 247 235 |  | 
| 248 236 |  | 
| @@ -263,9 +251,8 @@ return its value. | |
| 263 251 |  | 
| 264 252 | 
             
            Examples:
         | 
| 265 253 |  | 
| 266 | 
            -
            ``` | 
| 267 | 
            -
            divs_counts = frame.eval_on_selector_all("div", "(divs, min) => divs.length >= min", 10)
         | 
| 268 | 
            -
             | 
| 254 | 
            +
            ```ruby
         | 
| 255 | 
            +
            divs_counts = frame.eval_on_selector_all("div", "(divs, min) => divs.length >= min", arg: 10)
         | 
| 269 256 | 
             
            ```
         | 
| 270 257 |  | 
| 271 258 |  | 
| @@ -285,28 +272,25 @@ If the function passed to the [Frame#evaluate](./frame#evaluate) returns a non-[ | |
| 285 272 | 
             
            [Frame#evaluate](./frame#evaluate) returns `undefined`. Playwright also supports transferring some additional values that are
         | 
| 286 273 | 
             
            not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
         | 
| 287 274 |  | 
| 288 | 
            -
            ``` | 
| 289 | 
            -
            result = frame.evaluate("([x, y]) => Promise.resolve(x * y)", [7, 8])
         | 
| 290 | 
            -
             | 
| 291 | 
            -
             | 
| 275 | 
            +
            ```ruby
         | 
| 276 | 
            +
            result = frame.evaluate("([x, y]) => Promise.resolve(x * y)", arg: [7, 8])
         | 
| 277 | 
            +
            puts result # => "56"
         | 
| 292 278 | 
             
            ```
         | 
| 293 279 |  | 
| 294 280 | 
             
            A string can also be passed in instead of a function.
         | 
| 295 281 |  | 
| 296 | 
            -
            ``` | 
| 297 | 
            -
             | 
| 282 | 
            +
            ```ruby
         | 
| 283 | 
            +
            puts frame.evaluate("1 + 2") # => 3
         | 
| 298 284 | 
             
            x = 10
         | 
| 299 | 
            -
             | 
| 300 | 
            -
             | 
| 285 | 
            +
            puts frame.evaluate("1 + #{x}") # => "11"
         | 
| 301 286 | 
             
            ```
         | 
| 302 287 |  | 
| 303 288 | 
             
            [ElementHandle](./element_handle) instances can be passed as an argument to the [Frame#evaluate](./frame#evaluate):
         | 
| 304 289 |  | 
| 305 | 
            -
            ``` | 
| 290 | 
            +
            ```ruby
         | 
| 306 291 | 
             
            body_handle = frame.query_selector("body")
         | 
| 307 | 
            -
            html = frame.evaluate("([body, suffix]) => body.innerHTML + suffix", [body_handle, "hello"])
         | 
| 308 | 
            -
            body_handle.dispose | 
| 309 | 
            -
             | 
| 292 | 
            +
            html = frame.evaluate("([body, suffix]) => body.innerHTML + suffix", arg: [body_handle, "hello"])
         | 
| 293 | 
            +
            body_handle.dispose
         | 
| 310 294 | 
             
            ```
         | 
| 311 295 |  | 
| 312 296 |  | 
| @@ -325,10 +309,9 @@ The only difference between [Frame#evaluate](./frame#evaluate) and [Frame#evalua | |
| 325 309 | 
             
            If the function, passed to the [Frame#evaluate_handle](./frame#evaluate_handle), returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), then
         | 
| 326 310 | 
             
            [Frame#evaluate_handle](./frame#evaluate_handle) would wait for the promise to resolve and return its value.
         | 
| 327 311 |  | 
| 328 | 
            -
            ``` | 
| 312 | 
            +
            ```ruby
         | 
| 329 313 | 
             
            a_window_handle = frame.evaluate_handle("Promise.resolve(window)")
         | 
| 330 314 | 
             
            a_window_handle # handle for the window object.
         | 
| 331 | 
            -
             | 
| 332 315 | 
             
            ```
         | 
| 333 316 |  | 
| 334 317 | 
             
            A string can also be passed in instead of a function.
         | 
| @@ -393,11 +376,10 @@ frame. | |
| 393 376 |  | 
| 394 377 | 
             
            This method throws an error if the frame has been detached before `frameElement()` returns.
         | 
| 395 378 |  | 
| 396 | 
            -
            ``` | 
| 397 | 
            -
            frame_element = frame.frame_element | 
| 398 | 
            -
            content_frame = frame_element.content_frame | 
| 399 | 
            -
             | 
| 400 | 
            -
             | 
| 379 | 
            +
            ```ruby
         | 
| 380 | 
            +
            frame_element = frame.frame_element
         | 
| 381 | 
            +
            content_frame = frame_element.content_frame
         | 
| 382 | 
            +
            puts frame == content_frame # => true
         | 
| 401 383 | 
             
            ```
         | 
| 402 384 |  | 
| 403 385 |  | 
| @@ -658,14 +640,13 @@ Returns the array of option values that have been successfully selected. | |
| 658 640 |  | 
| 659 641 | 
             
            Triggers a `change` and `input` event once all the provided options have been selected.
         | 
| 660 642 |  | 
| 661 | 
            -
            ``` | 
| 643 | 
            +
            ```ruby
         | 
| 662 644 | 
             
            # single selection matching the value
         | 
| 663 | 
            -
            frame.select_option("select#colors", "blue")
         | 
| 645 | 
            +
            frame.select_option("select#colors", value: "blue")
         | 
| 664 646 | 
             
            # single selection matching both the label
         | 
| 665 | 
            -
            frame.select_option("select#colors", label | 
| 647 | 
            +
            frame.select_option("select#colors", label: "blue")
         | 
| 666 648 | 
             
            # multiple selection
         | 
| 667 | 
            -
            frame.select_option("select#colors", value | 
| 668 | 
            -
             | 
| 649 | 
            +
            frame.select_option("select#colors", value: ["red", "green", "blue"])
         | 
| 669 650 | 
             
            ```
         | 
| 670 651 |  | 
| 671 652 |  | 
| @@ -756,10 +737,9 @@ send fine-grained keyboard events. To fill values in form fields, use [Frame#fil | |
| 756 737 |  | 
| 757 738 | 
             
            To press a special key, like `Control` or `ArrowDown`, use [Keyboard#press](./keyboard#press).
         | 
| 758 739 |  | 
| 759 | 
            -
            ``` | 
| 740 | 
            +
            ```ruby
         | 
| 760 741 | 
             
            frame.type("#mytextarea", "hello") # types instantly
         | 
| 761 | 
            -
            frame.type("#mytextarea", "world", delay | 
| 762 | 
            -
             | 
| 742 | 
            +
            frame.type("#mytextarea", "world", delay: 100) # types slower, like a user
         | 
| 763 743 | 
             
            ```
         | 
| 764 744 |  | 
| 765 745 |  | 
| @@ -809,28 +789,16 @@ Returns when the `expression` returns a truthy value, returns that value. | |
| 809 789 |  | 
| 810 790 | 
             
            The [Frame#wait_for_function](./frame#wait_for_function) can be used to observe viewport size change:
         | 
| 811 791 |  | 
| 812 | 
            -
            ``` | 
| 813 | 
            -
             | 
| 814 | 
            -
             | 
| 815 | 
            -
            def run(playwright):
         | 
| 816 | 
            -
                webkit = playwright.webkit
         | 
| 817 | 
            -
                browser = webkit.launch()
         | 
| 818 | 
            -
                page = browser.new_page()
         | 
| 819 | 
            -
                page.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);")
         | 
| 820 | 
            -
                page.main_frame.wait_for_function("() => window.x > 0")
         | 
| 821 | 
            -
                browser.close()
         | 
| 822 | 
            -
             | 
| 823 | 
            -
            with sync_playwright() as playwright:
         | 
| 824 | 
            -
                run(playwright)
         | 
| 825 | 
            -
             | 
| 792 | 
            +
            ```ruby
         | 
| 793 | 
            +
            frame.evaluate("window.x = 0; setTimeout(() => { window.x = 100 }, 1000);")
         | 
| 794 | 
            +
            frame.wait_for_function("() => window.x > 0")
         | 
| 826 795 | 
             
            ```
         | 
| 827 796 |  | 
| 828 797 | 
             
            To pass an argument to the predicate of `frame.waitForFunction` function:
         | 
| 829 798 |  | 
| 830 | 
            -
            ``` | 
| 799 | 
            +
            ```ruby
         | 
| 831 800 | 
             
            selector = ".foo"
         | 
| 832 | 
            -
            frame.wait_for_function("selector => !!document.querySelector(selector)", selector)
         | 
| 833 | 
            -
             | 
| 801 | 
            +
            frame.wait_for_function("selector => !!document.querySelector(selector)", arg: selector)
         | 
| 834 802 | 
             
            ```
         | 
| 835 803 |  | 
| 836 804 |  | 
| @@ -846,10 +814,9 @@ Waits for the required load state to be reached. | |
| 846 814 | 
             
            This returns when the frame reaches a required load state, `load` by default. The navigation must have been committed
         | 
| 847 815 | 
             
            when this method is called. If current document has already reached the required state, resolves immediately.
         | 
| 848 816 |  | 
| 849 | 
            -
            ``` | 
| 817 | 
            +
            ```ruby
         | 
| 850 818 | 
             
            frame.click("button") # click triggers navigation.
         | 
| 851 | 
            -
            frame.wait_for_load_state | 
| 852 | 
            -
             | 
| 819 | 
            +
            frame.wait_for_load_state # the promise resolves after "load" event.
         | 
| 853 820 | 
             
            ```
         | 
| 854 821 |  | 
| 855 822 |  | 
| @@ -867,11 +834,10 @@ History API usage, the navigation will resolve with `null`. | |
| 867 834 | 
             
            This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause
         | 
| 868 835 | 
             
            the frame to navigate. Consider this example:
         | 
| 869 836 |  | 
| 870 | 
            -
            ``` | 
| 871 | 
            -
             | 
| 872 | 
            -
             | 
| 873 | 
            -
            # Resolves after navigation has finished
         | 
| 874 | 
            -
             | 
| 837 | 
            +
            ```ruby
         | 
| 838 | 
            +
            frame.expect_navigation do
         | 
| 839 | 
            +
              frame.click("a.delayed-navigation") # clicking the link will indirectly cause a navigation
         | 
| 840 | 
            +
            end # Resolves after navigation has finished
         | 
| 875 841 | 
             
            ```
         | 
| 876 842 |  | 
| 877 843 | 
             
            > NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
         | 
| @@ -892,22 +858,13 @@ selector doesn't satisfy the condition for the `timeout` milliseconds, the funct | |
| 892 858 |  | 
| 893 859 | 
             
            This method works across navigations:
         | 
| 894 860 |  | 
| 895 | 
            -
            ``` | 
| 896 | 
            -
             | 
| 897 | 
            -
             | 
| 898 | 
            -
             | 
| 899 | 
            -
             | 
| 900 | 
            -
             | 
| 901 | 
            -
             | 
| 902 | 
            -
                for current_url in ["https://google.com", "https://bbc.com"]:
         | 
| 903 | 
            -
                    page.goto(current_url, wait_until="domcontentloaded")
         | 
| 904 | 
            -
                    element = page.main_frame.wait_for_selector("img")
         | 
| 905 | 
            -
                    print("Loaded image: " + str(element.get_attribute("src")))
         | 
| 906 | 
            -
                browser.close()
         | 
| 907 | 
            -
             | 
| 908 | 
            -
            with sync_playwright() as playwright:
         | 
| 909 | 
            -
                run(playwright)
         | 
| 910 | 
            -
             | 
| 861 | 
            +
            ```ruby
         | 
| 862 | 
            +
            %w[https://google.com https://bbc.com].each do |current_url|
         | 
| 863 | 
            +
              page.goto(current_url, waitUntil: "domcontentloaded")
         | 
| 864 | 
            +
              frame = page.main_frame
         | 
| 865 | 
            +
              element = frame.wait_for_selector("img")
         | 
| 866 | 
            +
              puts "Loaded image: #{element["src"]}"
         | 
| 867 | 
            +
            end
         | 
| 911 868 | 
             
            ```
         | 
| 912 869 |  | 
| 913 870 |  | 
| @@ -931,10 +888,9 @@ def wait_for_url(url, timeout: nil, waitUntil: nil) | |
| 931 888 |  | 
| 932 889 | 
             
            Waits for the frame to navigate to the given URL.
         | 
| 933 890 |  | 
| 934 | 
            -
            ``` | 
| 891 | 
            +
            ```ruby
         | 
| 935 892 | 
             
            frame.click("a.delayed-navigation") # clicking the link will indirectly cause a navigation
         | 
| 936 893 | 
             
            frame.wait_for_url("**/target.html")
         | 
| 937 | 
            -
             | 
| 938 894 | 
             
            ```
         | 
| 939 895 |  | 
| 940 896 |  | 
| @@ -253,8 +253,8 @@ def evaluate_all(expression, arg: nil) | |
| 253 253 | 
             
            The method finds all elements matching the specified locator and passes an array of matched elements as a first argument
         | 
| 254 254 | 
             
            to `expression`. Returns the result of `expression` invocation.
         | 
| 255 255 |  | 
| 256 | 
            -
            If `expression` returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), then [ | 
| 257 | 
            -
            value.
         | 
| 256 | 
            +
            If `expression` returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), then [Locator#evaluate_all](./locator#evaluate_all) would wait for the promise to resolve and
         | 
| 257 | 
            +
            return its value.
         | 
| 258 258 |  | 
| 259 259 | 
             
            Examples:
         | 
| 260 260 |  | 
| @@ -8,16 +8,15 @@ The Mouse class operates in main-frame CSS pixels relative to the top-left corne | |
| 8 8 |  | 
| 9 9 | 
             
            Every `page` object has its own Mouse, accessible with [Page#mouse](./page#mouse).
         | 
| 10 10 |  | 
| 11 | 
            -
            ``` | 
| 11 | 
            +
            ```ruby
         | 
| 12 12 | 
             
            # using ‘page.mouse’ to trace a 100x100 square.
         | 
| 13 13 | 
             
            page.mouse.move(0, 0)
         | 
| 14 | 
            -
            page.mouse.down | 
| 14 | 
            +
            page.mouse.down
         | 
| 15 15 | 
             
            page.mouse.move(0, 100)
         | 
| 16 16 | 
             
            page.mouse.move(100, 100)
         | 
| 17 17 | 
             
            page.mouse.move(100, 0)
         | 
| 18 18 | 
             
            page.mouse.move(0, 0)
         | 
| 19 | 
            -
            page.mouse.up | 
| 20 | 
            -
             | 
| 19 | 
            +
            page.mouse.up
         | 
| 21 20 | 
             
            ```
         | 
| 22 21 |  | 
| 23 22 |  | 
| @@ -28,9 +28,8 @@ The method returns `null` unless this request has failed, as reported by `reques | |
| 28 28 |  | 
| 29 29 | 
             
            Example of logging of all the failed requests:
         | 
| 30 30 |  | 
| 31 | 
            -
            ``` | 
| 32 | 
            -
            page.on("requestfailed",  | 
| 33 | 
            -
             | 
| 31 | 
            +
            ```ruby
         | 
| 32 | 
            +
            page.on("requestfailed", ->(request) { puts "#{request.url} #{request.failure}" })
         | 
| 34 33 | 
             
            ```
         | 
| 35 34 |  | 
| 36 35 |  | 
| @@ -108,18 +107,17 @@ construct the whole redirect chain by repeatedly calling `redirectedFrom()`. | |
| 108 107 |  | 
| 109 108 | 
             
            For example, if the website `http://example.com` redirects to `https://example.com`:
         | 
| 110 109 |  | 
| 111 | 
            -
            ``` | 
| 112 | 
            -
            response = page.goto("http:// | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 110 | 
            +
            ```ruby
         | 
| 111 | 
            +
            response = page.goto("http://github.com")
         | 
| 112 | 
            +
            puts response.url # => "https://github.com"
         | 
| 113 | 
            +
            puts response.request.redirected_from&.url # => "http://github.com"
         | 
| 115 114 | 
             
            ```
         | 
| 116 115 |  | 
| 117 116 | 
             
            If the website `https://google.com` has no redirects:
         | 
| 118 117 |  | 
| 119 | 
            -
            ``` | 
| 118 | 
            +
            ```ruby
         | 
| 120 119 | 
             
            response = page.goto("https://google.com")
         | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 120 | 
            +
            puts response.request.redirected_from&.url # => nil
         | 
| 123 121 | 
             
            ```
         | 
| 124 122 |  | 
| 125 123 |  | 
| @@ -134,9 +132,8 @@ New request issued by the browser if the server responded with redirect. | |
| 134 132 |  | 
| 135 133 | 
             
            This method is the opposite of [Request#redirected_from](./request#redirected_from):
         | 
| 136 134 |  | 
| 137 | 
            -
            ``` | 
| 138 | 
            -
             | 
| 139 | 
            -
             | 
| 135 | 
            +
            ```ruby
         | 
| 136 | 
            +
            request.redirected_from.redirected_to # equals to request
         | 
| 140 137 | 
             
            ```
         | 
| 141 138 |  | 
| 142 139 |  | 
| @@ -169,12 +166,11 @@ Returns resource timing information for given request. Most of the timing values | |
| 169 166 | 
             
            `responseEnd` becomes available when request finishes. Find more information at
         | 
| 170 167 | 
             
            [Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming).
         | 
| 171 168 |  | 
| 172 | 
            -
            ``` | 
| 173 | 
            -
             | 
| 174 | 
            -
             | 
| 175 | 
            -
             | 
| 176 | 
            -
             | 
| 177 | 
            -
             | 
| 169 | 
            +
            ```ruby
         | 
| 170 | 
            +
            request = page.expect_event("requestfinished") do
         | 
| 171 | 
            +
              page.goto("https://example.com")
         | 
| 172 | 
            +
            end
         | 
| 173 | 
            +
            puts request.timing
         | 
| 178 174 | 
             
            ```
         | 
| 179 175 |  | 
| 180 176 |  | 
| @@ -9,13 +9,14 @@ Playwright script runs. | |
| 9 9 |  | 
| 10 10 | 
             
            Start with specifying the folder traces will be stored in:
         | 
| 11 11 |  | 
| 12 | 
            -
            ``` | 
| 13 | 
            -
            browser  | 
| 14 | 
            -
            context =  | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 12 | 
            +
            ```ruby
         | 
| 13 | 
            +
            browser.new_page do |page|
         | 
| 14 | 
            +
              context = page.context
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              context.tracing.start(screenshots: true, snapshots: true)
         | 
| 17 | 
            +
              page.goto('https://playwright.dev')
         | 
| 18 | 
            +
              context.tracing.stop(path: 'trace.zip')
         | 
| 19 | 
            +
            end
         | 
| 19 20 | 
             
            ```
         | 
| 20 21 |  | 
| 21 22 |  | 
| @@ -28,12 +29,12 @@ def start(name: nil, screenshots: nil, snapshots: nil) | |
| 28 29 |  | 
| 29 30 | 
             
            Start tracing.
         | 
| 30 31 |  | 
| 31 | 
            -
            ``` | 
| 32 | 
            -
            context | 
| 33 | 
            -
            page.goto("https://playwright.dev")
         | 
| 34 | 
            -
            context.tracing.stop()
         | 
| 35 | 
            -
            context.tracing.stop(path = "trace.zip")
         | 
| 32 | 
            +
            ```ruby
         | 
| 33 | 
            +
            context = page.context
         | 
| 36 34 |  | 
| 35 | 
            +
            context.tracing.start(name: 'trace', screenshots: true, snapshots: true)
         | 
| 36 | 
            +
            page.goto('https://playwright.dev')
         | 
| 37 | 
            +
            context.tracing.stop(path: 'trace.zip')
         | 
| 37 38 | 
             
            ```
         | 
| 38 39 |  | 
| 39 40 |  | 
| @@ -100,14 +100,14 @@ module Playwright | |
| 100 100 | 
             
                              request_start:,
         | 
| 101 101 | 
             
                              response_start:)
         | 
| 102 102 |  | 
| 103 | 
            -
                  @timing[ | 
| 104 | 
            -
                  @timing[ | 
| 105 | 
            -
                  @timing[ | 
| 106 | 
            -
                  @timing[ | 
| 107 | 
            -
                  @timing[ | 
| 108 | 
            -
                  @timing[ | 
| 109 | 
            -
                  @timing[ | 
| 110 | 
            -
                  @timing[ | 
| 103 | 
            +
                  @timing[:startTime] = start_time
         | 
| 104 | 
            +
                  @timing[:domainLookupStart] = domain_lookup_start
         | 
| 105 | 
            +
                  @timing[:domainLookupEnd] = domain_lookup_end
         | 
| 106 | 
            +
                  @timing[:connectStart] = connect_start
         | 
| 107 | 
            +
                  @timing[:secureConnectionStart] = secure_connection_start
         | 
| 108 | 
            +
                  @timing[:connectEnd] = connect_end
         | 
| 109 | 
            +
                  @timing[:requestStart] = request_start
         | 
| 110 | 
            +
                  @timing[:responseStart] = response_start
         | 
| 111 111 | 
             
                end
         | 
| 112 112 |  | 
| 113 113 | 
             
                private def update_headers(headers)
         | 
| @@ -142,7 +142,7 @@ module Playwright | |
| 142 142 | 
             
                  LocatorImpl.new(
         | 
| 143 143 | 
             
                    frame: @frame,
         | 
| 144 144 | 
             
                    timeout_settings: @timeout_settings,
         | 
| 145 | 
            -
                    selector: "#{@selector} >>  | 
| 145 | 
            +
                    selector: "#{@selector} >> nth=0",
         | 
| 146 146 | 
             
                  )
         | 
| 147 147 | 
             
                end
         | 
| 148 148 |  | 
| @@ -150,7 +150,7 @@ module Playwright | |
| 150 150 | 
             
                  LocatorImpl.new(
         | 
| 151 151 | 
             
                    frame: @frame,
         | 
| 152 152 | 
             
                    timeout_settings: @timeout_settings,
         | 
| 153 | 
            -
                    selector: "#{@selector} >>  | 
| 153 | 
            +
                    selector: "#{@selector} >> nth=-1",
         | 
| 154 154 | 
             
                  )
         | 
| 155 155 | 
             
                end
         | 
| 156 156 |  | 
| @@ -158,7 +158,7 @@ module Playwright | |
| 158 158 | 
             
                  LocatorImpl.new(
         | 
| 159 159 | 
             
                    frame: @frame,
         | 
| 160 160 | 
             
                    timeout_settings: @timeout_settings,
         | 
| 161 | 
            -
                    selector: "#{@selector} >>  | 
| 161 | 
            +
                    selector: "#{@selector} >> nth=#{index}",
         | 
| 162 162 | 
             
                  )
         | 
| 163 163 | 
             
                end
         | 
| 164 164 |  | 
    
        data/lib/playwright/version.rb
    CHANGED
    
    
| @@ -1,6 +1,19 @@ | |
| 1 1 | 
             
            module Playwright
         | 
| 2 | 
            -
              # Playwright has **experimental** support for Android automation.  | 
| 3 | 
            -
              # | 
| 2 | 
            +
              # Playwright has **experimental** support for Android automation. This includes Chrome for Android and Android WebView.
         | 
| 3 | 
            +
              #
         | 
| 4 | 
            +
              # *Requirements*
         | 
| 5 | 
            +
              # - Android device or AVD Emulator.
         | 
| 6 | 
            +
              # - [ADB daemon](https://developer.android.com/studio/command-line/adb) running and authenticated with your device.
         | 
| 7 | 
            +
              #   Typically running `adb devices` is all you need to do.
         | 
| 8 | 
            +
              # - [`Chrome 87`](https://play.google.com/store/apps/details?id=com.android.chrome) or newer installed on the device
         | 
| 9 | 
            +
              # - "Enable command line on non-rooted devices" enabled in `chrome://flags`.
         | 
| 10 | 
            +
              #
         | 
| 11 | 
            +
              # *Known limitations*
         | 
| 12 | 
            +
              # - Raw USB operation is not yet supported, so you need ADB.
         | 
| 13 | 
            +
              # - Device needs to be awake to produce screenshots. Enabling "Stay awake" developer mode will help.
         | 
| 14 | 
            +
              # - We didn't run all the tests against the device, so not everything works.
         | 
| 15 | 
            +
              #
         | 
| 16 | 
            +
              # *How to run*
         | 
| 4 17 | 
             
              #
         | 
| 5 18 | 
             
              # An example of the Android automation script would be:
         | 
| 6 19 | 
             
              #
         | 
| @@ -197,8 +197,8 @@ module Playwright | |
| 197 197 | 
             
                # The method finds all elements matching the specified locator and passes an array of matched elements as a first argument
         | 
| 198 198 | 
             
                # to `expression`. Returns the result of `expression` invocation.
         | 
| 199 199 | 
             
                #
         | 
| 200 | 
            -
                # If `expression` returns a [Promise], then [`Locator.evaluateAll`] would wait for the promise to resolve and | 
| 201 | 
            -
                # value.
         | 
| 200 | 
            +
                # If `expression` returns a [Promise], then [`method: Locator.evaluateAll`] would wait for the promise to resolve and
         | 
| 201 | 
            +
                # return its value.
         | 
| 202 202 | 
             
                #
         | 
| 203 203 | 
             
                # Examples:
         | 
| 204 204 | 
             
                #
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: playwright-ruby-client
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.14. | 
| 4 | 
            +
              version: 1.14.beta3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - YusukeIwaki
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021-08- | 
| 11 | 
            +
            date: 2021-08-12 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: concurrent-ruby
         |