playwright-ruby-client 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/documentation/docs/api/browser_type.md +53 -0
- data/documentation/docs/api/route.md +20 -21
- data/documentation/docs/article/guides/rails_integration.md +1 -1
- data/documentation/docs/include/api_coverage.md +1 -1
- data/lib/playwright/channel_owners/browser_type.rb +18 -0
- data/lib/playwright/version.rb +1 -1
- data/lib/playwright_api/browser_type.rb +3 -2
- data/lib/playwright_api/page.rb +4 -4
- 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: 2c3d1d005addff01402de5290c11dbac3aaac9a49608b7d88b3f86dffac45090
|
4
|
+
data.tar.gz: 3bde2b4a9f082fbdfb8b4577cfc6afadf19fe538e741b2bd4728ea942e3dd85b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a48cffd45f0ffd1a946c08d7ab920aac304812545271e7c250eae1bf0004d4c5be78688b04a513c5ec950b8e9d5c90c54f8e18c24e9e0856be8aa739c0e379b
|
7
|
+
data.tar.gz: 9b75e4959d91687cc995453f9ae76fea2b62c4641f949b9c60a197c0d11ad70060405159180309bc874fa0945a40d97c07ff2aa8033eb0e60fc2d12fc5a781b1
|
@@ -96,6 +96,59 @@ differences between Chromium and Chrome.
|
|
96
96
|
[This article](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md)
|
97
97
|
describes some differences for Linux users.
|
98
98
|
|
99
|
+
## launch_persistent_context
|
100
|
+
|
101
|
+
```
|
102
|
+
def launch_persistent_context(
|
103
|
+
userDataDir,
|
104
|
+
acceptDownloads: nil,
|
105
|
+
args: nil,
|
106
|
+
bypassCSP: nil,
|
107
|
+
channel: nil,
|
108
|
+
chromiumSandbox: nil,
|
109
|
+
colorScheme: nil,
|
110
|
+
deviceScaleFactor: nil,
|
111
|
+
devtools: nil,
|
112
|
+
downloadsPath: nil,
|
113
|
+
env: nil,
|
114
|
+
executablePath: nil,
|
115
|
+
extraHTTPHeaders: nil,
|
116
|
+
geolocation: nil,
|
117
|
+
handleSIGHUP: nil,
|
118
|
+
handleSIGINT: nil,
|
119
|
+
handleSIGTERM: nil,
|
120
|
+
hasTouch: nil,
|
121
|
+
headless: nil,
|
122
|
+
httpCredentials: nil,
|
123
|
+
ignoreDefaultArgs: nil,
|
124
|
+
ignoreHTTPSErrors: nil,
|
125
|
+
isMobile: nil,
|
126
|
+
javaScriptEnabled: nil,
|
127
|
+
locale: nil,
|
128
|
+
noViewport: nil,
|
129
|
+
offline: nil,
|
130
|
+
permissions: nil,
|
131
|
+
proxy: nil,
|
132
|
+
record_har_omit_content: nil,
|
133
|
+
record_har_path: nil,
|
134
|
+
record_video_dir: nil,
|
135
|
+
record_video_size: nil,
|
136
|
+
reducedMotion: nil,
|
137
|
+
screen: nil,
|
138
|
+
slowMo: nil,
|
139
|
+
timeout: nil,
|
140
|
+
timezoneId: nil,
|
141
|
+
tracesDir: nil,
|
142
|
+
userAgent: nil,
|
143
|
+
viewport: nil,
|
144
|
+
&block)
|
145
|
+
```
|
146
|
+
|
147
|
+
Returns the persistent browser context instance.
|
148
|
+
|
149
|
+
Launches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing this
|
150
|
+
context will automatically close the browser.
|
151
|
+
|
99
152
|
## name
|
100
153
|
|
101
154
|
```
|
@@ -23,18 +23,16 @@ def continue(headers: nil, method: nil, postData: nil, url: nil)
|
|
23
23
|
|
24
24
|
Continues route's request with optional overrides.
|
25
25
|
|
26
|
-
```
|
27
|
-
def handle(route, request)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
page.route("**/*", handle)
|
37
|
-
|
26
|
+
```ruby
|
27
|
+
def handle(route, request)
|
28
|
+
# override headers
|
29
|
+
headers = request.headers
|
30
|
+
headers['foo'] = 'bar' # set "foo" header
|
31
|
+
headers['user-agent'] = 'Unknown Browser' # modify user-agent
|
32
|
+
|
33
|
+
route.continue(headers: headers)
|
34
|
+
end
|
35
|
+
page.route("**/*", method(:handle))
|
38
36
|
```
|
39
37
|
|
40
38
|
|
@@ -54,19 +52,20 @@ Fulfills route's request with given response.
|
|
54
52
|
|
55
53
|
An example of fulfilling all requests with 404 responses:
|
56
54
|
|
57
|
-
```
|
58
|
-
page.route("**/*",
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
55
|
+
```ruby
|
56
|
+
page.route("**/*", ->(route, request) {
|
57
|
+
route.fulfill(
|
58
|
+
status: 404,
|
59
|
+
contentType: 'text/plain',
|
60
|
+
body: 'not found!!',
|
61
|
+
)
|
62
|
+
})
|
63
63
|
```
|
64
64
|
|
65
65
|
An example of serving static file:
|
66
66
|
|
67
|
-
```
|
68
|
-
page.route("**/xhr_endpoint",
|
69
|
-
|
67
|
+
```ruby
|
68
|
+
page.route("**/xhr_endpoint", ->(route, _) { route.fulfill(path: "mock_data.json") })
|
70
69
|
```
|
71
70
|
|
72
71
|
|
@@ -202,4 +202,4 @@ end
|
|
202
202
|
|
203
203
|
* Playwright doesn't allow clicking invisible DOM elements or moving elements. `click` sometimes doesn't work as Selenium does. See the detail in https://playwright.dev/docs/actionability/
|
204
204
|
* `current_window.maximize` and `current_window.fullscreen` work only on headful (non-headless) mode, as selenium driver does.
|
205
|
-
* `Capybara::Node::Element#drag_to` does not accept `html5` parameter
|
205
|
+
* `Capybara::Node::Element#drag_to` does not accept `html5` parameter.
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Playwright
|
2
2
|
define_channel_owner :BrowserType do
|
3
|
+
include Utils::PrepareBrowserContextOptions
|
4
|
+
|
3
5
|
def name
|
4
6
|
@initializer['name']
|
5
7
|
end
|
@@ -20,6 +22,22 @@ module Playwright
|
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
25
|
+
def launch_persistent_context(userDataDir, **options, &block)
|
26
|
+
params = options.dup
|
27
|
+
prepare_browser_context_options(params)
|
28
|
+
params['userDataDir'] = userDataDir
|
29
|
+
|
30
|
+
resp = @channel.send_message_to_server('launchPersistentContext', params.compact)
|
31
|
+
context = ChannelOwners::Browser.from(resp)
|
32
|
+
return context unless block
|
33
|
+
|
34
|
+
begin
|
35
|
+
block.call(context)
|
36
|
+
ensure
|
37
|
+
context.close
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
23
41
|
def connect_over_cdp(endpointURL, headers: nil, slowMo: nil, timeout: nil, &block)
|
24
42
|
raise 'Connecting over CDP is only supported in Chromium.' unless name == 'chromium'
|
25
43
|
|
data/lib/playwright/version.rb
CHANGED
@@ -133,8 +133,9 @@ module Playwright
|
|
133
133
|
timezoneId: nil,
|
134
134
|
tracesDir: nil,
|
135
135
|
userAgent: nil,
|
136
|
-
viewport: nil
|
137
|
-
|
136
|
+
viewport: nil,
|
137
|
+
&block)
|
138
|
+
wrap_impl(@impl.launch_persistent_context(unwrap_impl(userDataDir), acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), 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)))
|
138
139
|
end
|
139
140
|
|
140
141
|
# Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
|
data/lib/playwright_api/page.rb
CHANGED
@@ -1273,8 +1273,8 @@ module Playwright
|
|
1273
1273
|
end
|
1274
1274
|
|
1275
1275
|
# @nodoc
|
1276
|
-
def
|
1277
|
-
wrap_impl(@impl.
|
1276
|
+
def stop_js_coverage
|
1277
|
+
wrap_impl(@impl.stop_js_coverage)
|
1278
1278
|
end
|
1279
1279
|
|
1280
1280
|
# @nodoc
|
@@ -1288,8 +1288,8 @@ module Playwright
|
|
1288
1288
|
end
|
1289
1289
|
|
1290
1290
|
# @nodoc
|
1291
|
-
def
|
1292
|
-
wrap_impl(@impl.
|
1291
|
+
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1292
|
+
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
1293
1293
|
end
|
1294
1294
|
|
1295
1295
|
# @nodoc
|
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: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YusukeIwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|