playwright-ruby-client 1.14.0 → 1.15.beta1
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/browser.md +2 -0
- data/documentation/docs/api/browser_type.md +1 -0
- data/documentation/docs/api/experimental/android_device.md +1 -0
- data/documentation/docs/api/frame.md +4 -6
- data/documentation/docs/api/locator.md +13 -0
- data/documentation/docs/api/page.md +3 -5
- data/documentation/docs/api/selectors.md +29 -3
- data/lib/playwright.rb +44 -4
- data/lib/playwright/channel_owners/browser_type.rb +0 -1
- data/lib/playwright/channel_owners/playwright.rb +9 -0
- data/lib/playwright/connection.rb +3 -8
- data/lib/playwright/utils.rb +0 -1
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/android.rb +6 -6
- data/lib/playwright_api/android_device.rb +8 -7
- data/lib/playwright_api/browser.rb +10 -8
- data/lib/playwright_api/browser_context.rb +6 -6
- data/lib/playwright_api/browser_type.rb +8 -7
- data/lib/playwright_api/cdp_session.rb +6 -6
- data/lib/playwright_api/console_message.rb +6 -6
- data/lib/playwright_api/dialog.rb +6 -6
- data/lib/playwright_api/element_handle.rb +6 -6
- data/lib/playwright_api/frame.rb +10 -12
- data/lib/playwright_api/js_handle.rb +6 -6
- data/lib/playwright_api/locator.rb +13 -0
- data/lib/playwright_api/page.rb +9 -11
- data/lib/playwright_api/playwright.rb +6 -6
- data/lib/playwright_api/request.rb +6 -6
- data/lib/playwright_api/response.rb +6 -6
- data/lib/playwright_api/route.rb +6 -6
- data/lib/playwright_api/selectors.rb +38 -7
- data/lib/playwright_api/web_socket.rb +6 -6
- data/lib/playwright_api/worker.rb +6 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae7bd712526c9e50089204c128fc6aff20ff430e2f58d04faea66d429ab53357
|
4
|
+
data.tar.gz: 95cb87802b32b1ce4487f6bc7a0fe897c5cdf285cef09700dc9472b8caea46d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6854306d49f2bdf5a2f51bcfc639297043a52d9f0c38b3eb1b8db3931462cd98c42f0d45a35867352dccce25637efcc414b5c14edfe9d332c176d10a9fe9723
|
7
|
+
data.tar.gz: 4e1e89f99491cb4d2cc3ef1092b5a95fcd7486b2b19cd45dcc01d2d25ac5884c4ab6ba956172f41017561aee74013c2902ac787d0d5a1d6b71ef5eacf8740056
|
@@ -99,6 +99,7 @@ def new_context(
|
|
99
99
|
reducedMotion: nil,
|
100
100
|
screen: nil,
|
101
101
|
storageState: nil,
|
102
|
+
strictSelectors: nil,
|
102
103
|
timezoneId: nil,
|
103
104
|
userAgent: nil,
|
104
105
|
viewport: nil,
|
@@ -148,6 +149,7 @@ def new_page(
|
|
148
149
|
reducedMotion: nil,
|
149
150
|
screen: nil,
|
150
151
|
storageState: nil,
|
152
|
+
strictSelectors: nil,
|
151
153
|
timezoneId: nil,
|
152
154
|
userAgent: nil,
|
153
155
|
viewport: nil,
|
@@ -401,18 +401,18 @@ def goto(url, referer: nil, timeout: nil, waitUntil: nil)
|
|
401
401
|
Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
|
402
402
|
last redirect.
|
403
403
|
|
404
|
-
|
404
|
+
The method will throw an error if:
|
405
405
|
- there's an SSL error (e.g. in case of self-signed certificates).
|
406
406
|
- target URL is invalid.
|
407
407
|
- the `timeout` is exceeded during navigation.
|
408
408
|
- the remote server does not respond or is unreachable.
|
409
409
|
- the main resource failed to load.
|
410
410
|
|
411
|
-
|
412
|
-
|
411
|
+
The method will not throw an error when any valid HTTP status code is returned by the remote server, including 404 "Not
|
412
|
+
Found" and 500 "Internal Server Error". The status code for such responses can be retrieved by calling
|
413
413
|
[Response#status](./response#status).
|
414
414
|
|
415
|
-
> NOTE:
|
415
|
+
> NOTE: The method either throws an error or returns a main resource response. The only exceptions are navigation to
|
416
416
|
`about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.
|
417
417
|
> NOTE: Headless mode doesn't support navigation to a PDF document. See the
|
418
418
|
[upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
|
@@ -533,8 +533,6 @@ The method returns an element locator that can be used to perform actions in the
|
|
533
533
|
element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
534
534
|
different DOM elements. That would happen if the DOM structure between those actions has changed.
|
535
535
|
|
536
|
-
Note that locator always implies visibility, so it will always be locating visible elements.
|
537
|
-
|
538
536
|
## name
|
539
537
|
|
540
538
|
```
|
@@ -34,6 +34,19 @@ locator.hover
|
|
34
34
|
locator.click
|
35
35
|
```
|
36
36
|
|
37
|
+
**Strictness**
|
38
|
+
|
39
|
+
Locators are strict. This means that all operations on locators that imply some target DOM element will throw if more
|
40
|
+
than one element matches given selector.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
# Throws if there are several buttons in DOM:
|
44
|
+
page.locator('button').click
|
45
|
+
|
46
|
+
# Works because we explicitly tell locator to pick the first element:
|
47
|
+
page.locator('button').first.click
|
48
|
+
```
|
49
|
+
|
37
50
|
|
38
51
|
|
39
52
|
## all_inner_texts
|
@@ -622,18 +622,18 @@ def goto(url, referer: nil, timeout: nil, waitUntil: nil)
|
|
622
622
|
Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
|
623
623
|
last redirect.
|
624
624
|
|
625
|
-
|
625
|
+
The method will throw an error if:
|
626
626
|
- there's an SSL error (e.g. in case of self-signed certificates).
|
627
627
|
- target URL is invalid.
|
628
628
|
- the `timeout` is exceeded during navigation.
|
629
629
|
- the remote server does not respond or is unreachable.
|
630
630
|
- the main resource failed to load.
|
631
631
|
|
632
|
-
|
632
|
+
The method will not throw an error when any valid HTTP status code is returned by the remote server, including 404 "Not
|
633
633
|
Found" and 500 "Internal Server Error". The status code for such responses can be retrieved by calling
|
634
634
|
[Response#status](./response#status).
|
635
635
|
|
636
|
-
> NOTE:
|
636
|
+
> NOTE: The method either throws an error or returns a main resource response. The only exceptions are navigation to
|
637
637
|
`about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.
|
638
638
|
> NOTE: Headless mode doesn't support navigation to a PDF document. See the
|
639
639
|
[upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
|
@@ -758,8 +758,6 @@ The method returns an element locator that can be used to perform actions on the
|
|
758
758
|
element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
759
759
|
different DOM elements. That would happen if the DOM structure between those actions has changed.
|
760
760
|
|
761
|
-
Note that locator always implies visibility, so it will always be locating visible elements.
|
762
|
-
|
763
761
|
Shortcut for main frame's [Frame#locator](./frame#locator).
|
764
762
|
|
765
763
|
## main_frame
|
@@ -15,9 +15,35 @@ def register(name, contentScript: nil, path: nil, script: nil)
|
|
15
15
|
|
16
16
|
An example of registering selector engine that queries elements based on a tag name:
|
17
17
|
|
18
|
-
```
|
19
|
-
|
20
|
-
|
18
|
+
```ruby
|
19
|
+
tag_selector = <<~JAVASCRIPT
|
20
|
+
{
|
21
|
+
// Returns the first element matching given selector in the root's subtree.
|
22
|
+
query(root, selector) {
|
23
|
+
return root.querySelector(selector);
|
24
|
+
},
|
25
|
+
// Returns all elements matching given selector in the root's subtree.
|
26
|
+
queryAll(root, selector) {
|
27
|
+
return Array.from(root.querySelectorAll(selector));
|
28
|
+
}
|
29
|
+
}
|
30
|
+
JAVASCRIPT
|
31
|
+
|
32
|
+
# Register the engine. Selectors will be prefixed with "tag=".
|
33
|
+
playwright.selectors.register("tag", script: tag_selector)
|
34
|
+
playwright.chromium.launch do |browser|
|
35
|
+
page = browser.new_page()
|
36
|
+
page.content = '<div><button>Click me</button></div>'
|
37
|
+
|
38
|
+
# Use the selector prefixed with its name.
|
39
|
+
button = page.query_selector('tag=button')
|
40
|
+
# Combine it with other selector engines.
|
41
|
+
page.click('tag=div >> text="Click me"')
|
42
|
+
|
43
|
+
# Can use it in any methods supporting selectors.
|
44
|
+
button_count = page.eval_on_selector_all('tag=button', 'buttons => buttons.length')
|
45
|
+
button_count # => 1
|
46
|
+
end
|
21
47
|
```
|
22
48
|
|
23
49
|
|
data/lib/playwright.rb
CHANGED
@@ -35,16 +35,18 @@ Dir[File.join(__dir__, 'playwright_api', '*.rb')].each { |f| require f }
|
|
35
35
|
|
36
36
|
module Playwright
|
37
37
|
class Execution
|
38
|
-
def initialize(connection, playwright)
|
38
|
+
def initialize(connection, playwright, browser = nil)
|
39
39
|
@connection = connection
|
40
40
|
@playwright = playwright
|
41
|
+
@browser = browser
|
41
42
|
end
|
42
43
|
|
43
44
|
def stop
|
45
|
+
@browser&.close
|
44
46
|
@connection.stop
|
45
47
|
end
|
46
48
|
|
47
|
-
attr_reader :playwright
|
49
|
+
attr_reader :playwright, :browser
|
48
50
|
end
|
49
51
|
|
50
52
|
# Recommended to call this method with block.
|
@@ -64,7 +66,7 @@ module Playwright
|
|
64
66
|
|
65
67
|
execution =
|
66
68
|
begin
|
67
|
-
playwright = connection.
|
69
|
+
playwright = connection.initialize_playwright
|
68
70
|
Execution.new(connection, PlaywrightApi.wrap(playwright))
|
69
71
|
rescue
|
70
72
|
connection.stop
|
@@ -100,7 +102,7 @@ module Playwright
|
|
100
102
|
|
101
103
|
execution =
|
102
104
|
begin
|
103
|
-
playwright = connection.
|
105
|
+
playwright = connection.initialize_playwright
|
104
106
|
Execution.new(connection, PlaywrightApi.wrap(playwright))
|
105
107
|
rescue
|
106
108
|
connection.stop
|
@@ -117,4 +119,42 @@ module Playwright
|
|
117
119
|
execution
|
118
120
|
end
|
119
121
|
end
|
122
|
+
|
123
|
+
# Connects to Playwright server, launched by `npx playwright launch-server chromium` or `playwright.chromium.launchServer()`
|
124
|
+
#
|
125
|
+
# Playwright.connect_to_browser_server('ws://....') do |browser|
|
126
|
+
# page = browser.new_page
|
127
|
+
# ...
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# @experimental
|
131
|
+
module_function def connect_to_browser_server(ws_endpoint, &block)
|
132
|
+
require 'playwright/web_socket_client'
|
133
|
+
require 'playwright/web_socket_transport'
|
134
|
+
|
135
|
+
transport = WebSocketTransport.new(ws_endpoint: ws_endpoint)
|
136
|
+
connection = Connection.new(transport)
|
137
|
+
connection.async_run
|
138
|
+
|
139
|
+
execution =
|
140
|
+
begin
|
141
|
+
playwright = connection.initialize_playwright
|
142
|
+
browser = playwright.send(:pre_launched_browser)
|
143
|
+
browser.send(:update_as_remote)
|
144
|
+
Execution.new(connection, PlaywrightApi.wrap(playwright), PlaywrightApi.wrap(browser))
|
145
|
+
rescue
|
146
|
+
connection.stop
|
147
|
+
raise
|
148
|
+
end
|
149
|
+
|
150
|
+
if block
|
151
|
+
begin
|
152
|
+
block.call(execution.browser)
|
153
|
+
ensure
|
154
|
+
execution.stop
|
155
|
+
end
|
156
|
+
else
|
157
|
+
execution
|
158
|
+
end
|
159
|
+
end
|
120
160
|
end
|
@@ -30,6 +30,15 @@ module Playwright
|
|
30
30
|
end.to_h
|
31
31
|
end
|
32
32
|
|
33
|
+
# used only from Playwright#connect_to_browser_server
|
34
|
+
private def pre_launched_browser
|
35
|
+
unless @initializer['preLaunchedBrowser']
|
36
|
+
raise 'Malformed endpoint. Did you use launchServer method?'
|
37
|
+
end
|
38
|
+
|
39
|
+
::Playwright::ChannelOwners::Browser.from(@initializer['preLaunchedBrowser'])
|
40
|
+
end
|
41
|
+
|
33
42
|
private def parse_device_descriptor(descriptor)
|
34
43
|
# This return value can be passed into Browser#new_context as it is.
|
35
44
|
# ex:
|
@@ -31,14 +31,9 @@ module Playwright
|
|
31
31
|
@transport.stop
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
callback = Concurrent::Promises.resolvable_future
|
40
|
-
@waiting_for_object[guid] = callback
|
41
|
-
callback.value!
|
34
|
+
def initialize_playwright
|
35
|
+
result = send_message_to_server('', 'initialize', { sdkLanguage: 'ruby' })
|
36
|
+
ChannelOwners::Playwright.from(result['playwright'])
|
42
37
|
end
|
43
38
|
|
44
39
|
def async_send_message_to_server(guid, method, params)
|
data/lib/playwright/utils.rb
CHANGED
@@ -3,7 +3,6 @@ module Playwright
|
|
3
3
|
module PrepareBrowserContextOptions
|
4
4
|
# @see https://github.com/microsoft/playwright/blob/5a2cfdbd47ed3c3deff77bb73e5fac34241f649d/src/client/browserContext.ts#L265
|
5
5
|
private def prepare_browser_context_options(params)
|
6
|
-
params[:sdkLanguage] = 'ruby'
|
7
6
|
if params[:noViewport] == 0
|
8
7
|
params.delete(:noViewport)
|
9
8
|
params[:noDefaultViewport] = true
|
data/lib/playwright/version.rb
CHANGED
@@ -36,12 +36,6 @@ module Playwright
|
|
36
36
|
end
|
37
37
|
alias_method :default_timeout=, :set_default_timeout
|
38
38
|
|
39
|
-
# -- inherited from EventEmitter --
|
40
|
-
# @nodoc
|
41
|
-
def once(event, callback)
|
42
|
-
event_emitter_proxy.once(event, callback)
|
43
|
-
end
|
44
|
-
|
45
39
|
# -- inherited from EventEmitter --
|
46
40
|
# @nodoc
|
47
41
|
def on(event, callback)
|
@@ -54,6 +48,12 @@ module Playwright
|
|
54
48
|
event_emitter_proxy.off(event, callback)
|
55
49
|
end
|
56
50
|
|
51
|
+
# -- inherited from EventEmitter --
|
52
|
+
# @nodoc
|
53
|
+
def once(event, callback)
|
54
|
+
event_emitter_proxy.once(event, callback)
|
55
|
+
end
|
56
|
+
|
57
57
|
private def event_emitter_proxy
|
58
58
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
59
59
|
end
|
@@ -62,11 +62,12 @@ module Playwright
|
|
62
62
|
record_video_size: nil,
|
63
63
|
reducedMotion: nil,
|
64
64
|
screen: nil,
|
65
|
+
strictSelectors: nil,
|
65
66
|
timezoneId: nil,
|
66
67
|
userAgent: nil,
|
67
68
|
viewport: nil,
|
68
69
|
&block)
|
69
|
-
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), 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), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
70
|
+
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), 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)))
|
70
71
|
end
|
71
72
|
|
72
73
|
# Performs a long tap on the widget defined by `selector`.
|
@@ -172,12 +173,6 @@ module Playwright
|
|
172
173
|
wrap_impl(@impl.tree)
|
173
174
|
end
|
174
175
|
|
175
|
-
# -- inherited from EventEmitter --
|
176
|
-
# @nodoc
|
177
|
-
def once(event, callback)
|
178
|
-
event_emitter_proxy.once(event, callback)
|
179
|
-
end
|
180
|
-
|
181
176
|
# -- inherited from EventEmitter --
|
182
177
|
# @nodoc
|
183
178
|
def on(event, callback)
|
@@ -190,6 +185,12 @@ module Playwright
|
|
190
185
|
event_emitter_proxy.off(event, callback)
|
191
186
|
end
|
192
187
|
|
188
|
+
# -- inherited from EventEmitter --
|
189
|
+
# @nodoc
|
190
|
+
def once(event, callback)
|
191
|
+
event_emitter_proxy.once(event, callback)
|
192
|
+
end
|
193
|
+
|
193
194
|
private def event_emitter_proxy
|
194
195
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
195
196
|
end
|
@@ -88,11 +88,12 @@ module Playwright
|
|
88
88
|
reducedMotion: nil,
|
89
89
|
screen: nil,
|
90
90
|
storageState: nil,
|
91
|
+
strictSelectors: nil,
|
91
92
|
timezoneId: nil,
|
92
93
|
userAgent: nil,
|
93
94
|
viewport: nil,
|
94
95
|
&block)
|
95
|
-
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), 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), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
96
|
+
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), 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)))
|
96
97
|
end
|
97
98
|
|
98
99
|
# Creates a new page in a new browser context. Closing this page will close the context as well.
|
@@ -125,11 +126,12 @@ module Playwright
|
|
125
126
|
reducedMotion: nil,
|
126
127
|
screen: nil,
|
127
128
|
storageState: nil,
|
129
|
+
strictSelectors: nil,
|
128
130
|
timezoneId: nil,
|
129
131
|
userAgent: nil,
|
130
132
|
viewport: nil,
|
131
133
|
&block)
|
132
|
-
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), 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), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
134
|
+
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), 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)))
|
133
135
|
end
|
134
136
|
|
135
137
|
# > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
|
@@ -162,12 +164,6 @@ module Playwright
|
|
162
164
|
wrap_impl(@impl.version)
|
163
165
|
end
|
164
166
|
|
165
|
-
# -- inherited from EventEmitter --
|
166
|
-
# @nodoc
|
167
|
-
def once(event, callback)
|
168
|
-
event_emitter_proxy.once(event, callback)
|
169
|
-
end
|
170
|
-
|
171
167
|
# -- inherited from EventEmitter --
|
172
168
|
# @nodoc
|
173
169
|
def on(event, callback)
|
@@ -180,6 +176,12 @@ module Playwright
|
|
180
176
|
event_emitter_proxy.off(event, callback)
|
181
177
|
end
|
182
178
|
|
179
|
+
# -- inherited from EventEmitter --
|
180
|
+
# @nodoc
|
181
|
+
def once(event, callback)
|
182
|
+
event_emitter_proxy.once(event, callback)
|
183
|
+
end
|
184
|
+
|
183
185
|
private def event_emitter_proxy
|
184
186
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
185
187
|
end
|
@@ -387,12 +387,6 @@ module Playwright
|
|
387
387
|
wrap_impl(@impl.options=(unwrap_impl(req)))
|
388
388
|
end
|
389
389
|
|
390
|
-
# -- inherited from EventEmitter --
|
391
|
-
# @nodoc
|
392
|
-
def once(event, callback)
|
393
|
-
event_emitter_proxy.once(event, callback)
|
394
|
-
end
|
395
|
-
|
396
390
|
# -- inherited from EventEmitter --
|
397
391
|
# @nodoc
|
398
392
|
def on(event, callback)
|
@@ -405,6 +399,12 @@ module Playwright
|
|
405
399
|
event_emitter_proxy.off(event, callback)
|
406
400
|
end
|
407
401
|
|
402
|
+
# -- inherited from EventEmitter --
|
403
|
+
# @nodoc
|
404
|
+
def once(event, callback)
|
405
|
+
event_emitter_proxy.once(event, callback)
|
406
|
+
end
|
407
|
+
|
408
408
|
private def event_emitter_proxy
|
409
409
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
410
410
|
end
|
@@ -130,13 +130,14 @@ module Playwright
|
|
130
130
|
reducedMotion: nil,
|
131
131
|
screen: nil,
|
132
132
|
slowMo: nil,
|
133
|
+
strictSelectors: nil,
|
133
134
|
timeout: nil,
|
134
135
|
timezoneId: nil,
|
135
136
|
tracesDir: nil,
|
136
137
|
userAgent: nil,
|
137
138
|
viewport: nil,
|
138
139
|
&block)
|
139
|
-
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), 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), timeout: unwrap_impl(timeout), timezoneId: unwrap_impl(timezoneId), tracesDir: unwrap_impl(tracesDir), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(viewport), &wrap_block_call(block)))
|
140
|
+
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), 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)))
|
140
141
|
end
|
141
142
|
|
142
143
|
# Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
|
@@ -144,12 +145,6 @@ module Playwright
|
|
144
145
|
wrap_impl(@impl.name)
|
145
146
|
end
|
146
147
|
|
147
|
-
# -- inherited from EventEmitter --
|
148
|
-
# @nodoc
|
149
|
-
def once(event, callback)
|
150
|
-
event_emitter_proxy.once(event, callback)
|
151
|
-
end
|
152
|
-
|
153
148
|
# -- inherited from EventEmitter --
|
154
149
|
# @nodoc
|
155
150
|
def on(event, callback)
|
@@ -162,6 +157,12 @@ module Playwright
|
|
162
157
|
event_emitter_proxy.off(event, callback)
|
163
158
|
end
|
164
159
|
|
160
|
+
# -- inherited from EventEmitter --
|
161
|
+
# @nodoc
|
162
|
+
def once(event, callback)
|
163
|
+
event_emitter_proxy.once(event, callback)
|
164
|
+
end
|
165
|
+
|
165
166
|
private def event_emitter_proxy
|
166
167
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
167
168
|
end
|
@@ -33,12 +33,6 @@ module Playwright
|
|
33
33
|
wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
|
34
34
|
end
|
35
35
|
|
36
|
-
# -- inherited from EventEmitter --
|
37
|
-
# @nodoc
|
38
|
-
def once(event, callback)
|
39
|
-
event_emitter_proxy.once(event, callback)
|
40
|
-
end
|
41
|
-
|
42
36
|
# -- inherited from EventEmitter --
|
43
37
|
# @nodoc
|
44
38
|
def on(event, callback)
|
@@ -51,6 +45,12 @@ module Playwright
|
|
51
45
|
event_emitter_proxy.off(event, callback)
|
52
46
|
end
|
53
47
|
|
48
|
+
# -- inherited from EventEmitter --
|
49
|
+
# @nodoc
|
50
|
+
def once(event, callback)
|
51
|
+
event_emitter_proxy.once(event, callback)
|
52
|
+
end
|
53
|
+
|
54
54
|
private def event_emitter_proxy
|
55
55
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
56
56
|
end
|
@@ -23,12 +23,6 @@ module Playwright
|
|
23
23
|
wrap_impl(@impl.type)
|
24
24
|
end
|
25
25
|
|
26
|
-
# -- inherited from EventEmitter --
|
27
|
-
# @nodoc
|
28
|
-
def once(event, callback)
|
29
|
-
event_emitter_proxy.once(event, callback)
|
30
|
-
end
|
31
|
-
|
32
26
|
# -- inherited from EventEmitter --
|
33
27
|
# @nodoc
|
34
28
|
def on(event, callback)
|
@@ -41,6 +35,12 @@ module Playwright
|
|
41
35
|
event_emitter_proxy.off(event, callback)
|
42
36
|
end
|
43
37
|
|
38
|
+
# -- inherited from EventEmitter --
|
39
|
+
# @nodoc
|
40
|
+
def once(event, callback)
|
41
|
+
event_emitter_proxy.once(event, callback)
|
42
|
+
end
|
43
|
+
|
44
44
|
private def event_emitter_proxy
|
45
45
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
46
46
|
end
|
@@ -58,12 +58,6 @@ module Playwright
|
|
58
58
|
wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
|
59
59
|
end
|
60
60
|
|
61
|
-
# -- inherited from EventEmitter --
|
62
|
-
# @nodoc
|
63
|
-
def once(event, callback)
|
64
|
-
event_emitter_proxy.once(event, callback)
|
65
|
-
end
|
66
|
-
|
67
61
|
# -- inherited from EventEmitter --
|
68
62
|
# @nodoc
|
69
63
|
def on(event, callback)
|
@@ -76,6 +70,12 @@ module Playwright
|
|
76
70
|
event_emitter_proxy.off(event, callback)
|
77
71
|
end
|
78
72
|
|
73
|
+
# -- inherited from EventEmitter --
|
74
|
+
# @nodoc
|
75
|
+
def once(event, callback)
|
76
|
+
event_emitter_proxy.once(event, callback)
|
77
|
+
end
|
78
|
+
|
79
79
|
private def event_emitter_proxy
|
80
80
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
81
81
|
end
|
@@ -529,12 +529,6 @@ module Playwright
|
|
529
529
|
wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), timeout: unwrap_impl(timeout)))
|
530
530
|
end
|
531
531
|
|
532
|
-
# -- inherited from EventEmitter --
|
533
|
-
# @nodoc
|
534
|
-
def once(event, callback)
|
535
|
-
event_emitter_proxy.once(event, callback)
|
536
|
-
end
|
537
|
-
|
538
532
|
# -- inherited from EventEmitter --
|
539
533
|
# @nodoc
|
540
534
|
def on(event, callback)
|
@@ -547,6 +541,12 @@ module Playwright
|
|
547
541
|
event_emitter_proxy.off(event, callback)
|
548
542
|
end
|
549
543
|
|
544
|
+
# -- inherited from EventEmitter --
|
545
|
+
# @nodoc
|
546
|
+
def once(event, callback)
|
547
|
+
event_emitter_proxy.once(event, callback)
|
548
|
+
end
|
549
|
+
|
550
550
|
private def event_emitter_proxy
|
551
551
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
552
552
|
end
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -332,18 +332,18 @@ module Playwright
|
|
332
332
|
# Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
|
333
333
|
# last redirect.
|
334
334
|
#
|
335
|
-
#
|
335
|
+
# The method will throw an error if:
|
336
336
|
# - there's an SSL error (e.g. in case of self-signed certificates).
|
337
337
|
# - target URL is invalid.
|
338
338
|
# - the `timeout` is exceeded during navigation.
|
339
339
|
# - the remote server does not respond or is unreachable.
|
340
340
|
# - the main resource failed to load.
|
341
341
|
#
|
342
|
-
#
|
343
|
-
#
|
342
|
+
# The method will not throw an error when any valid HTTP status code is returned by the remote server, including 404 "Not
|
343
|
+
# Found" and 500 "Internal Server Error". The status code for such responses can be retrieved by calling
|
344
344
|
# [`method: Response.status`].
|
345
345
|
#
|
346
|
-
# > NOTE:
|
346
|
+
# > NOTE: The method either throws an error or returns a main resource response. The only exceptions are navigation to
|
347
347
|
# `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.
|
348
348
|
# > NOTE: Headless mode doesn't support navigation to a PDF document. See the
|
349
349
|
# [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
|
@@ -427,8 +427,6 @@ module Playwright
|
|
427
427
|
# The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
|
428
428
|
# element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
429
429
|
# different DOM elements. That would happen if the DOM structure between those actions has changed.
|
430
|
-
#
|
431
|
-
# Note that locator always implies visibility, so it will always be locating visible elements.
|
432
430
|
def locator(selector)
|
433
431
|
wrap_impl(@impl.locator(unwrap_impl(selector)))
|
434
432
|
end
|
@@ -740,12 +738,6 @@ module Playwright
|
|
740
738
|
wrap_impl(@impl.detached=(unwrap_impl(req)))
|
741
739
|
end
|
742
740
|
|
743
|
-
# -- inherited from EventEmitter --
|
744
|
-
# @nodoc
|
745
|
-
def once(event, callback)
|
746
|
-
event_emitter_proxy.once(event, callback)
|
747
|
-
end
|
748
|
-
|
749
741
|
# -- inherited from EventEmitter --
|
750
742
|
# @nodoc
|
751
743
|
def on(event, callback)
|
@@ -758,6 +750,12 @@ module Playwright
|
|
758
750
|
event_emitter_proxy.off(event, callback)
|
759
751
|
end
|
760
752
|
|
753
|
+
# -- inherited from EventEmitter --
|
754
|
+
# @nodoc
|
755
|
+
def once(event, callback)
|
756
|
+
event_emitter_proxy.once(event, callback)
|
757
|
+
end
|
758
|
+
|
761
759
|
private def event_emitter_proxy
|
762
760
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
763
761
|
end
|
@@ -88,12 +88,6 @@ module Playwright
|
|
88
88
|
wrap_impl(@impl.to_s)
|
89
89
|
end
|
90
90
|
|
91
|
-
# -- inherited from EventEmitter --
|
92
|
-
# @nodoc
|
93
|
-
def once(event, callback)
|
94
|
-
event_emitter_proxy.once(event, callback)
|
95
|
-
end
|
96
|
-
|
97
91
|
# -- inherited from EventEmitter --
|
98
92
|
# @nodoc
|
99
93
|
def on(event, callback)
|
@@ -106,6 +100,12 @@ module Playwright
|
|
106
100
|
event_emitter_proxy.off(event, callback)
|
107
101
|
end
|
108
102
|
|
103
|
+
# -- inherited from EventEmitter --
|
104
|
+
# @nodoc
|
105
|
+
def once(event, callback)
|
106
|
+
event_emitter_proxy.once(event, callback)
|
107
|
+
end
|
108
|
+
|
109
109
|
private def event_emitter_proxy
|
110
110
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
111
111
|
end
|
@@ -28,6 +28,19 @@ module Playwright
|
|
28
28
|
# locator.hover()
|
29
29
|
# locator.click()
|
30
30
|
# ```
|
31
|
+
#
|
32
|
+
# **Strictness**
|
33
|
+
#
|
34
|
+
# Locators are strict. This means that all operations on locators that imply some target DOM element will throw if more
|
35
|
+
# than one element matches given selector.
|
36
|
+
#
|
37
|
+
# ```python sync
|
38
|
+
# # Throws if there are several buttons in DOM:
|
39
|
+
# page.locator('button').click()
|
40
|
+
#
|
41
|
+
# # Works because we explicitly tell locator to pick the first element:
|
42
|
+
# page.locator('button').first.click()
|
43
|
+
# ```
|
31
44
|
class Locator < PlaywrightApi
|
32
45
|
|
33
46
|
# Returns an array of `node.innerText` values for all matching nodes.
|
data/lib/playwright_api/page.rb
CHANGED
@@ -562,18 +562,18 @@ module Playwright
|
|
562
562
|
# Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
|
563
563
|
# last redirect.
|
564
564
|
#
|
565
|
-
#
|
565
|
+
# The method will throw an error if:
|
566
566
|
# - there's an SSL error (e.g. in case of self-signed certificates).
|
567
567
|
# - target URL is invalid.
|
568
568
|
# - the `timeout` is exceeded during navigation.
|
569
569
|
# - the remote server does not respond or is unreachable.
|
570
570
|
# - the main resource failed to load.
|
571
571
|
#
|
572
|
-
#
|
572
|
+
# The method will not throw an error when any valid HTTP status code is returned by the remote server, including 404 "Not
|
573
573
|
# Found" and 500 "Internal Server Error". The status code for such responses can be retrieved by calling
|
574
574
|
# [`method: Response.status`].
|
575
575
|
#
|
576
|
-
# > NOTE:
|
576
|
+
# > NOTE: The method either throws an error or returns a main resource response. The only exceptions are navigation to
|
577
577
|
# `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.
|
578
578
|
# > NOTE: Headless mode doesn't support navigation to a PDF document. See the
|
579
579
|
# [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
|
@@ -662,8 +662,6 @@ module Playwright
|
|
662
662
|
# element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
663
663
|
# different DOM elements. That would happen if the DOM structure between those actions has changed.
|
664
664
|
#
|
665
|
-
# Note that locator always implies visibility, so it will always be locating visible elements.
|
666
|
-
#
|
667
665
|
# Shortcut for main frame's [`method: Frame.locator`].
|
668
666
|
def locator(selector)
|
669
667
|
wrap_impl(@impl.locator(unwrap_impl(selector)))
|
@@ -1352,12 +1350,6 @@ module Playwright
|
|
1352
1350
|
wrap_impl(@impl.guid)
|
1353
1351
|
end
|
1354
1352
|
|
1355
|
-
# -- inherited from EventEmitter --
|
1356
|
-
# @nodoc
|
1357
|
-
def once(event, callback)
|
1358
|
-
event_emitter_proxy.once(event, callback)
|
1359
|
-
end
|
1360
|
-
|
1361
1353
|
# -- inherited from EventEmitter --
|
1362
1354
|
# @nodoc
|
1363
1355
|
def on(event, callback)
|
@@ -1370,6 +1362,12 @@ module Playwright
|
|
1370
1362
|
event_emitter_proxy.off(event, callback)
|
1371
1363
|
end
|
1372
1364
|
|
1365
|
+
# -- inherited from EventEmitter --
|
1366
|
+
# @nodoc
|
1367
|
+
def once(event, callback)
|
1368
|
+
event_emitter_proxy.once(event, callback)
|
1369
|
+
end
|
1370
|
+
|
1373
1371
|
private def event_emitter_proxy
|
1374
1372
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
1375
1373
|
end
|
@@ -91,12 +91,6 @@ module Playwright
|
|
91
91
|
wrap_impl(@impl.electron)
|
92
92
|
end
|
93
93
|
|
94
|
-
# -- inherited from EventEmitter --
|
95
|
-
# @nodoc
|
96
|
-
def once(event, callback)
|
97
|
-
event_emitter_proxy.once(event, callback)
|
98
|
-
end
|
99
|
-
|
100
94
|
# -- inherited from EventEmitter --
|
101
95
|
# @nodoc
|
102
96
|
def on(event, callback)
|
@@ -109,6 +103,12 @@ module Playwright
|
|
109
103
|
event_emitter_proxy.off(event, callback)
|
110
104
|
end
|
111
105
|
|
106
|
+
# -- inherited from EventEmitter --
|
107
|
+
# @nodoc
|
108
|
+
def once(event, callback)
|
109
|
+
event_emitter_proxy.once(event, callback)
|
110
|
+
end
|
111
|
+
|
112
112
|
private def event_emitter_proxy
|
113
113
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
114
114
|
end
|
@@ -128,12 +128,6 @@ module Playwright
|
|
128
128
|
wrap_impl(@impl.url)
|
129
129
|
end
|
130
130
|
|
131
|
-
# -- inherited from EventEmitter --
|
132
|
-
# @nodoc
|
133
|
-
def once(event, callback)
|
134
|
-
event_emitter_proxy.once(event, callback)
|
135
|
-
end
|
136
|
-
|
137
131
|
# -- inherited from EventEmitter --
|
138
132
|
# @nodoc
|
139
133
|
def on(event, callback)
|
@@ -146,6 +140,12 @@ module Playwright
|
|
146
140
|
event_emitter_proxy.off(event, callback)
|
147
141
|
end
|
148
142
|
|
143
|
+
# -- inherited from EventEmitter --
|
144
|
+
# @nodoc
|
145
|
+
def once(event, callback)
|
146
|
+
event_emitter_proxy.once(event, callback)
|
147
|
+
end
|
148
|
+
|
149
149
|
private def event_emitter_proxy
|
150
150
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
151
151
|
end
|
@@ -74,12 +74,6 @@ module Playwright
|
|
74
74
|
wrap_impl(@impl.ok?)
|
75
75
|
end
|
76
76
|
|
77
|
-
# -- inherited from EventEmitter --
|
78
|
-
# @nodoc
|
79
|
-
def once(event, callback)
|
80
|
-
event_emitter_proxy.once(event, callback)
|
81
|
-
end
|
82
|
-
|
83
77
|
# -- inherited from EventEmitter --
|
84
78
|
# @nodoc
|
85
79
|
def on(event, callback)
|
@@ -92,6 +86,12 @@ module Playwright
|
|
92
86
|
event_emitter_proxy.off(event, callback)
|
93
87
|
end
|
94
88
|
|
89
|
+
# -- inherited from EventEmitter --
|
90
|
+
# @nodoc
|
91
|
+
def once(event, callback)
|
92
|
+
event_emitter_proxy.once(event, callback)
|
93
|
+
end
|
94
|
+
|
95
95
|
private def event_emitter_proxy
|
96
96
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
97
97
|
end
|
data/lib/playwright_api/route.rb
CHANGED
@@ -56,12 +56,6 @@ module Playwright
|
|
56
56
|
wrap_impl(@impl.request)
|
57
57
|
end
|
58
58
|
|
59
|
-
# -- inherited from EventEmitter --
|
60
|
-
# @nodoc
|
61
|
-
def once(event, callback)
|
62
|
-
event_emitter_proxy.once(event, callback)
|
63
|
-
end
|
64
|
-
|
65
59
|
# -- inherited from EventEmitter --
|
66
60
|
# @nodoc
|
67
61
|
def on(event, callback)
|
@@ -74,6 +68,12 @@ module Playwright
|
|
74
68
|
event_emitter_proxy.off(event, callback)
|
75
69
|
end
|
76
70
|
|
71
|
+
# -- inherited from EventEmitter --
|
72
|
+
# @nodoc
|
73
|
+
def once(event, callback)
|
74
|
+
event_emitter_proxy.once(event, callback)
|
75
|
+
end
|
76
|
+
|
77
77
|
private def event_emitter_proxy
|
78
78
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
79
79
|
end
|
@@ -6,18 +6,43 @@ module Playwright
|
|
6
6
|
# An example of registering selector engine that queries elements based on a tag name:
|
7
7
|
#
|
8
8
|
# ```python sync
|
9
|
-
#
|
9
|
+
# from playwright.sync_api import sync_playwright
|
10
|
+
#
|
11
|
+
# def run(playwright):
|
12
|
+
# tag_selector = """
|
13
|
+
# {
|
14
|
+
# // Returns the first element matching given selector in the root's subtree.
|
15
|
+
# query(root, selector) {
|
16
|
+
# return root.querySelector(selector);
|
17
|
+
# },
|
18
|
+
# // Returns all elements matching given selector in the root's subtree.
|
19
|
+
# queryAll(root, selector) {
|
20
|
+
# return Array.from(root.querySelectorAll(selector));
|
21
|
+
# }
|
22
|
+
# }"""
|
23
|
+
#
|
24
|
+
# # Register the engine. Selectors will be prefixed with "tag=".
|
25
|
+
# playwright.selectors.register("tag", tag_selector)
|
26
|
+
# browser = playwright.chromium.launch()
|
27
|
+
# page = browser.new_page()
|
28
|
+
# page.set_content('<div><button>Click me</button></div>')
|
29
|
+
#
|
30
|
+
# # Use the selector prefixed with its name.
|
31
|
+
# button = page.query_selector('tag=button')
|
32
|
+
# # Combine it with other selector engines.
|
33
|
+
# page.click('tag=div >> text="Click me"')
|
34
|
+
# # Can use it in any methods supporting selectors.
|
35
|
+
# button_count = page.eval_on_selector_all('tag=button', 'buttons => buttons.length')
|
36
|
+
# print(button_count)
|
37
|
+
# browser.close()
|
38
|
+
#
|
39
|
+
# with sync_playwright() as playwright:
|
40
|
+
# run(playwright)
|
10
41
|
# ```
|
11
42
|
def register(name, contentScript: nil, path: nil, script: nil)
|
12
43
|
wrap_impl(@impl.register(unwrap_impl(name), contentScript: unwrap_impl(contentScript), path: unwrap_impl(path), script: unwrap_impl(script)))
|
13
44
|
end
|
14
45
|
|
15
|
-
# -- inherited from EventEmitter --
|
16
|
-
# @nodoc
|
17
|
-
def once(event, callback)
|
18
|
-
event_emitter_proxy.once(event, callback)
|
19
|
-
end
|
20
|
-
|
21
46
|
# -- inherited from EventEmitter --
|
22
47
|
# @nodoc
|
23
48
|
def on(event, callback)
|
@@ -30,6 +55,12 @@ module Playwright
|
|
30
55
|
event_emitter_proxy.off(event, callback)
|
31
56
|
end
|
32
57
|
|
58
|
+
# -- inherited from EventEmitter --
|
59
|
+
# @nodoc
|
60
|
+
def once(event, callback)
|
61
|
+
event_emitter_proxy.once(event, callback)
|
62
|
+
end
|
63
|
+
|
33
64
|
private def event_emitter_proxy
|
34
65
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
35
66
|
end
|
@@ -27,12 +27,6 @@ module Playwright
|
|
27
27
|
wrap_impl(@impl.wait_for_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
28
28
|
end
|
29
29
|
|
30
|
-
# -- inherited from EventEmitter --
|
31
|
-
# @nodoc
|
32
|
-
def once(event, callback)
|
33
|
-
event_emitter_proxy.once(event, callback)
|
34
|
-
end
|
35
|
-
|
36
30
|
# -- inherited from EventEmitter --
|
37
31
|
# @nodoc
|
38
32
|
def on(event, callback)
|
@@ -45,6 +39,12 @@ module Playwright
|
|
45
39
|
event_emitter_proxy.off(event, callback)
|
46
40
|
end
|
47
41
|
|
42
|
+
# -- inherited from EventEmitter --
|
43
|
+
# @nodoc
|
44
|
+
def once(event, callback)
|
45
|
+
event_emitter_proxy.once(event, callback)
|
46
|
+
end
|
47
|
+
|
48
48
|
private def event_emitter_proxy
|
49
49
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
50
50
|
end
|
@@ -53,12 +53,6 @@ module Playwright
|
|
53
53
|
wrap_impl(@impl.page=(unwrap_impl(req)))
|
54
54
|
end
|
55
55
|
|
56
|
-
# -- inherited from EventEmitter --
|
57
|
-
# @nodoc
|
58
|
-
def once(event, callback)
|
59
|
-
event_emitter_proxy.once(event, callback)
|
60
|
-
end
|
61
|
-
|
62
56
|
# -- inherited from EventEmitter --
|
63
57
|
# @nodoc
|
64
58
|
def on(event, callback)
|
@@ -71,6 +65,12 @@ module Playwright
|
|
71
65
|
event_emitter_proxy.off(event, callback)
|
72
66
|
end
|
73
67
|
|
68
|
+
# -- inherited from EventEmitter --
|
69
|
+
# @nodoc
|
70
|
+
def once(event, callback)
|
71
|
+
event_emitter_proxy.once(event, callback)
|
72
|
+
end
|
73
|
+
|
74
74
|
private def event_emitter_proxy
|
75
75
|
@event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
|
76
76
|
end
|
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.
|
4
|
+
version: 1.15.beta1
|
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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -372,12 +372,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
372
372
|
version: '2.4'
|
373
373
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
374
374
|
requirements:
|
375
|
-
- - "
|
375
|
+
- - ">"
|
376
376
|
- !ruby/object:Gem::Version
|
377
|
-
version:
|
377
|
+
version: 1.3.1
|
378
378
|
requirements: []
|
379
379
|
rubygems_version: 3.2.22
|
380
380
|
signing_key:
|
381
381
|
specification_version: 4
|
382
|
-
summary: The Ruby binding of playwright driver 1.
|
382
|
+
summary: The Ruby binding of playwright driver 1.15.0
|
383
383
|
test_files: []
|