playwright-ruby-client 1.17.1 → 1.18.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/api_request_context.md +45 -133
- data/documentation/docs/api/browser_context.md +0 -4
- data/documentation/docs/api/download.md +1 -3
- data/documentation/docs/api/frame.md +1 -1
- data/documentation/docs/api/frame_locator.md +10 -1
- data/documentation/docs/api/locator.md +19 -47
- data/documentation/docs/api/page.md +1 -1
- data/documentation/docs/include/api_coverage.md +16 -28
- data/lib/playwright/channel_owners/api_request_context.rb +0 -232
- data/lib/playwright/channel_owners/browser_context.rb +6 -3
- data/lib/playwright/channel_owners/frame.rb +2 -2
- data/lib/playwright/channel_owners/local_utils.rb +14 -0
- data/lib/playwright/channel_owners/page.rb +2 -6
- data/lib/playwright/frame_locator_impl.rb +2 -1
- data/lib/playwright/locator_impl.rb +62 -3
- data/lib/playwright/tracing_impl.rb +21 -7
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/api_request_context.rb +55 -8
- data/lib/playwright_api/browser_context.rb +6 -6
- data/lib/playwright_api/download.rb +0 -4
- data/lib/playwright_api/frame.rb +2 -2
- data/lib/playwright_api/frame_locator.rb +11 -2
- data/lib/playwright_api/local_utils.rb +9 -0
- data/lib/playwright_api/locator.rb +16 -46
- data/lib/playwright_api/page.rb +7 -7
- metadata +7 -10
- data/documentation/docs/api/api_request.md +0 -7
- data/documentation/docs/api/api_response.md +0 -90
- data/lib/playwright/api_response_impl.rb +0 -73
- data/lib/playwright_api/api_request.rb +0 -18
- data/lib/playwright_api/api_response.rb +0 -68
@@ -0,0 +1,14 @@
|
|
1
|
+
module Playwright
|
2
|
+
define_channel_owner :LocalUtils do
|
3
|
+
# @param zip_file [String]
|
4
|
+
# @param name_value_array [Array<Hash<{name: string, value: string}>>]
|
5
|
+
def zip(zip_file, name_value_array)
|
6
|
+
params = {
|
7
|
+
zipFile: zip_file,
|
8
|
+
entries: name_value_array,
|
9
|
+
}
|
10
|
+
@channel.send_message_to_server('zip', params)
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -558,8 +558,8 @@ module Playwright
|
|
558
558
|
timeout: timeout)
|
559
559
|
end
|
560
560
|
|
561
|
-
def locator(selector)
|
562
|
-
@main_frame.locator(selector)
|
561
|
+
def locator(selector, hasText: nil)
|
562
|
+
@main_frame.locator(selector, hasText: hasText)
|
563
563
|
end
|
564
564
|
|
565
565
|
def frame_locator(selector)
|
@@ -733,10 +733,6 @@ module Playwright
|
|
733
733
|
@workers.to_a
|
734
734
|
end
|
735
735
|
|
736
|
-
def request
|
737
|
-
@browser_context.request
|
738
|
-
end
|
739
|
-
|
740
736
|
def pause
|
741
737
|
@browser_context.send(:pause)
|
742
738
|
end
|
@@ -6,11 +6,12 @@ module Playwright
|
|
6
6
|
@frame_selector = frame_selector
|
7
7
|
end
|
8
8
|
|
9
|
-
def locator(selector)
|
9
|
+
def locator(selector, hasText: nil)
|
10
10
|
LocatorImpl.new(
|
11
11
|
frame: @frame,
|
12
12
|
timeout_settings: @timeout_settings,
|
13
13
|
selector: "#{@frame_selector} >> control=enter-frame >> #{selector}",
|
14
|
+
hasText: hasText,
|
14
15
|
)
|
15
16
|
end
|
16
17
|
|
@@ -1,9 +1,46 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Playwright
|
4
|
+
class EscapeWithQuotes
|
5
|
+
def initialize(text, char = "'")
|
6
|
+
stringified = text.to_json
|
7
|
+
escaped_text = stringified[1...-1].gsub(/\\"/, '"')
|
8
|
+
|
9
|
+
case char
|
10
|
+
when '"'
|
11
|
+
text = escaped_text.gsub(/["]/, '\\"')
|
12
|
+
@text = "\"#{text}\""
|
13
|
+
when "'"
|
14
|
+
text = escaped_text.gsub(/[']/, '\\\'')
|
15
|
+
@text = "'#{text}'"
|
16
|
+
else
|
17
|
+
raise ArgumentError.new('Invalid escape char')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
@text
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
2
26
|
define_api_implementation :LocatorImpl do
|
3
|
-
def initialize(frame:, timeout_settings:, selector:)
|
27
|
+
def initialize(frame:, timeout_settings:, selector:, hasText: nil)
|
4
28
|
@frame = frame
|
5
29
|
@timeout_settings = timeout_settings
|
6
|
-
@selector =
|
30
|
+
@selector =
|
31
|
+
case hasText
|
32
|
+
when Regexp
|
33
|
+
source = EscapeWithQuotes.new(hasText.source, '"')
|
34
|
+
flags = []
|
35
|
+
flags << 'ms' if (hasText.options & Regexp::MULTILINE) != 0
|
36
|
+
flags << 'i' if (hasText.options & Regexp::IGNORECASE) != 0
|
37
|
+
"#{selector} >> :scope:text-matches(#{source}, \"#{flags.join('')}\")"
|
38
|
+
when String
|
39
|
+
text = EscapeWithQuotes.new(hasText, '"')
|
40
|
+
"#{selector} >> :scope:has-text(#{text})"
|
41
|
+
else
|
42
|
+
selector
|
43
|
+
end
|
7
44
|
end
|
8
45
|
|
9
46
|
def to_s
|
@@ -102,6 +139,27 @@ module Playwright
|
|
102
139
|
@frame.dispatch_event(@selector, type, strict: true, eventInit: eventInit, timeout: timeout)
|
103
140
|
end
|
104
141
|
|
142
|
+
def drag_to(target,
|
143
|
+
force: nil,
|
144
|
+
noWaitAfter: nil,
|
145
|
+
sourcePosition: nil,
|
146
|
+
targetPosition: nil,
|
147
|
+
timeout: nil,
|
148
|
+
trial: nil)
|
149
|
+
|
150
|
+
@frame.drag_and_drop(
|
151
|
+
@selector,
|
152
|
+
target.instance_variable_get(:@selector),
|
153
|
+
force: force,
|
154
|
+
noWaitAfter: noWaitAfter,
|
155
|
+
sourcePosition: sourcePosition,
|
156
|
+
targetPosition: targetPosition,
|
157
|
+
timeout: timeout,
|
158
|
+
trial: trial,
|
159
|
+
strict: true,
|
160
|
+
)
|
161
|
+
end
|
162
|
+
|
105
163
|
def evaluate(expression, arg: nil, timeout: nil)
|
106
164
|
with_element(timeout: timeout) do |handle|
|
107
165
|
handle.evaluate(expression, arg: arg)
|
@@ -122,11 +180,12 @@ module Playwright
|
|
122
180
|
@frame.fill(@selector, value, strict: true, force: force, noWaitAfter: noWaitAfter, timeout: timeout)
|
123
181
|
end
|
124
182
|
|
125
|
-
def locator(selector)
|
183
|
+
def locator(selector, hasText: nil)
|
126
184
|
LocatorImpl.new(
|
127
185
|
frame: @frame,
|
128
186
|
timeout_settings: @timeout_settings,
|
129
187
|
selector: "#{@selector} >> #{selector}",
|
188
|
+
hasText: hasText,
|
130
189
|
)
|
131
190
|
end
|
132
191
|
|
@@ -20,21 +20,35 @@ module Playwright
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def stop_chunk(path: nil)
|
23
|
-
do_stop_chunk(
|
23
|
+
do_stop_chunk(file_path: path)
|
24
24
|
end
|
25
25
|
|
26
26
|
def stop(path: nil)
|
27
|
-
do_stop_chunk(
|
27
|
+
do_stop_chunk(file_path: path)
|
28
28
|
@channel.send_message_to_server('tracingStop')
|
29
29
|
end
|
30
30
|
|
31
|
-
private def do_stop_chunk(
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
private def do_stop_chunk(file_path:)
|
32
|
+
mode = 'doNotSave'
|
33
|
+
if file_path
|
34
|
+
if @context.send(:remote_connection?)
|
35
|
+
mode = 'compressTrace'
|
36
|
+
else
|
37
|
+
mode = 'compressTraceAndSources'
|
38
|
+
end
|
39
|
+
end
|
35
40
|
|
36
|
-
|
41
|
+
result = @channel.send_message_to_server_result('tracingStopChunk', mode: mode)
|
42
|
+
return unless file_path # Not interested in artifacts.
|
43
|
+
return unless result['artifact'] # The artifact may be missing if the browser closed while stopping tracing.
|
44
|
+
|
45
|
+
artifact = ChannelOwners::Artifact.from(result['artifact'])
|
46
|
+
artifact.save_as(file_path)
|
37
47
|
artifact.delete
|
48
|
+
|
49
|
+
# // Add local sources to the remote trace if necessary.
|
50
|
+
# if (result.sourceEntries?.length)
|
51
|
+
# await this._context._localUtils.zip(filePath, result.sourceEntries);
|
38
52
|
end
|
39
53
|
end
|
40
54
|
end
|
data/lib/playwright/version.rb
CHANGED
@@ -3,6 +3,53 @@ module Playwright
|
|
3
3
|
# environment or the service to your e2e test. When used on `Page` or a `BrowserContext`, this API will automatically use
|
4
4
|
# the cookies from the corresponding `BrowserContext`. This means that if you log in using this API, your e2e test will be
|
5
5
|
# logged in and vice versa.
|
6
|
+
#
|
7
|
+
# ```python sync
|
8
|
+
# import os
|
9
|
+
# from playwright.sync_api import sync_playwright
|
10
|
+
#
|
11
|
+
# REPO = "test-repo-1"
|
12
|
+
# USER = "github-username"
|
13
|
+
# API_TOKEN = os.getenv("GITHUB_API_TOKEN")
|
14
|
+
#
|
15
|
+
# with sync_playwright() as p:
|
16
|
+
# # This will launch a new browser, create a context and page. When making HTTP
|
17
|
+
# # requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)
|
18
|
+
# # it will automatically set the cookies to the browser page and vise versa.
|
19
|
+
# browser = playwright.chromium.launch()
|
20
|
+
# context = browser.new_context(base_url="https://api.github.com")
|
21
|
+
# api_request_context = context.request
|
22
|
+
# page = context.new_page()
|
23
|
+
#
|
24
|
+
# # Alternatively you can create a APIRequestContext manually without having a browser context attached:
|
25
|
+
# # api_request_context = playwright.request.new_context(base_url="https://api.github.com")
|
26
|
+
#
|
27
|
+
#
|
28
|
+
# # Create a repository.
|
29
|
+
# response = api_request_context.post(
|
30
|
+
# "/user/repos",
|
31
|
+
# headers={
|
32
|
+
# "Accept": "application/vnd.github.v3+json",
|
33
|
+
# # Add GitHub personal access token.
|
34
|
+
# "Authorization": f"token {API_TOKEN}",
|
35
|
+
# },
|
36
|
+
# data={"name": REPO},
|
37
|
+
# )
|
38
|
+
# assert response.ok
|
39
|
+
# assert response.json()["name"] == REPO
|
40
|
+
#
|
41
|
+
# # Delete a repository.
|
42
|
+
# response = api_request_context.delete(
|
43
|
+
# f"/repos/{USER}/{REPO}",
|
44
|
+
# headers={
|
45
|
+
# "Accept": "application/vnd.github.v3+json",
|
46
|
+
# # Add GitHub personal access token.
|
47
|
+
# "Authorization": f"token {API_TOKEN}",
|
48
|
+
# },
|
49
|
+
# )
|
50
|
+
# assert response.ok
|
51
|
+
# assert await response.body() == '{"status": "ok"}'
|
52
|
+
# ```
|
6
53
|
class APIRequestContext < PlaywrightApi
|
7
54
|
|
8
55
|
# Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its
|
@@ -18,14 +65,14 @@ module Playwright
|
|
18
65
|
multipart: nil,
|
19
66
|
params: nil,
|
20
67
|
timeout: nil)
|
21
|
-
|
68
|
+
raise NotImplementedError.new('delete is not implemented yet.')
|
22
69
|
end
|
23
70
|
|
24
71
|
# All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you
|
25
72
|
# can later call [`method: APIResponse.body`]. This method discards all stored responses, and makes
|
26
73
|
# [`method: APIResponse.body`] throw "Response disposed" error.
|
27
74
|
def dispose
|
28
|
-
|
75
|
+
raise NotImplementedError.new('dispose is not implemented yet.')
|
29
76
|
end
|
30
77
|
|
31
78
|
# Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
|
@@ -41,7 +88,7 @@ module Playwright
|
|
41
88
|
multipart: nil,
|
42
89
|
params: nil,
|
43
90
|
timeout: nil)
|
44
|
-
|
91
|
+
raise NotImplementedError.new('fetch is not implemented yet.')
|
45
92
|
end
|
46
93
|
|
47
94
|
# Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. The
|
@@ -54,7 +101,7 @@ module Playwright
|
|
54
101
|
ignoreHTTPSErrors: nil,
|
55
102
|
params: nil,
|
56
103
|
timeout: nil)
|
57
|
-
|
104
|
+
raise NotImplementedError.new('get is not implemented yet.')
|
58
105
|
end
|
59
106
|
|
60
107
|
# Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response.
|
@@ -67,7 +114,7 @@ module Playwright
|
|
67
114
|
ignoreHTTPSErrors: nil,
|
68
115
|
params: nil,
|
69
116
|
timeout: nil)
|
70
|
-
|
117
|
+
raise NotImplementedError.new('head is not implemented yet.')
|
71
118
|
end
|
72
119
|
|
73
120
|
# Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response.
|
@@ -83,7 +130,7 @@ module Playwright
|
|
83
130
|
multipart: nil,
|
84
131
|
params: nil,
|
85
132
|
timeout: nil)
|
86
|
-
|
133
|
+
raise NotImplementedError.new('patch is not implemented yet.')
|
87
134
|
end
|
88
135
|
|
89
136
|
# Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.
|
@@ -99,7 +146,7 @@ module Playwright
|
|
99
146
|
multipart: nil,
|
100
147
|
params: nil,
|
101
148
|
timeout: nil)
|
102
|
-
|
149
|
+
raise NotImplementedError.new('post is not implemented yet.')
|
103
150
|
end
|
104
151
|
|
105
152
|
# Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. The
|
@@ -115,7 +162,7 @@ module Playwright
|
|
115
162
|
multipart: nil,
|
116
163
|
params: nil,
|
117
164
|
timeout: nil)
|
118
|
-
|
165
|
+
raise NotImplementedError.new('put is not implemented yet.')
|
119
166
|
end
|
120
167
|
|
121
168
|
# Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to
|
@@ -22,7 +22,7 @@ module Playwright
|
|
22
22
|
|
23
23
|
# API testing helper associated with this context. Requests made with this API will use context cookies.
|
24
24
|
def request # property
|
25
|
-
|
25
|
+
raise NotImplementedError.new('request is not implemented yet.')
|
26
26
|
end
|
27
27
|
|
28
28
|
def tracing # property
|
@@ -376,11 +376,6 @@ module Playwright
|
|
376
376
|
wrap_impl(@impl.pause)
|
377
377
|
end
|
378
378
|
|
379
|
-
# @nodoc
|
380
|
-
def enable_debug_console!
|
381
|
-
wrap_impl(@impl.enable_debug_console!)
|
382
|
-
end
|
383
|
-
|
384
379
|
# @nodoc
|
385
380
|
def browser=(req)
|
386
381
|
wrap_impl(@impl.browser=(unwrap_impl(req)))
|
@@ -396,6 +391,11 @@ module Playwright
|
|
396
391
|
wrap_impl(@impl.options=(unwrap_impl(req)))
|
397
392
|
end
|
398
393
|
|
394
|
+
# @nodoc
|
395
|
+
def enable_debug_console!
|
396
|
+
wrap_impl(@impl.enable_debug_console!)
|
397
|
+
end
|
398
|
+
|
399
399
|
# -- inherited from EventEmitter --
|
400
400
|
# @nodoc
|
401
401
|
def once(event, callback)
|
@@ -12,10 +12,6 @@ module Playwright
|
|
12
12
|
# # wait for download to complete
|
13
13
|
# path = download.path()
|
14
14
|
# ```
|
15
|
-
#
|
16
|
-
# > NOTE: Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the
|
17
|
-
# downloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not
|
18
|
-
# performed and user has no access to the downloaded files.
|
19
15
|
class Download < PlaywrightApi
|
20
16
|
|
21
17
|
# Cancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations,
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -445,8 +445,8 @@ module Playwright
|
|
445
445
|
# The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
|
446
446
|
# element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
|
447
447
|
# different DOM elements. That would happen if the DOM structure between those actions has changed.
|
448
|
-
def locator(selector)
|
449
|
-
wrap_impl(@impl.locator(unwrap_impl(selector)))
|
448
|
+
def locator(selector, hasText: nil)
|
449
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), hasText: unwrap_impl(hasText)))
|
450
450
|
end
|
451
451
|
|
452
452
|
# Returns frame's name attribute as specified in the tag.
|
@@ -20,6 +20,15 @@ module Playwright
|
|
20
20
|
# # Works because we explicitly tell locator to pick the first frame:
|
21
21
|
# page.frame_locator('.result-frame').first.locator('button').click()
|
22
22
|
# ```
|
23
|
+
#
|
24
|
+
# **Converting Locator to FrameLocator**
|
25
|
+
#
|
26
|
+
# If you have a `Locator` object pointing to an `iframe` it can be converted to `FrameLocator` using
|
27
|
+
# [`:scope`](https://developer.mozilla.org/en-US/docs/Web/CSS/:scope) CSS selector:
|
28
|
+
#
|
29
|
+
# ```python sync
|
30
|
+
# frameLocator = locator.frame_locator(":scope");
|
31
|
+
# ```
|
23
32
|
class FrameLocator < PlaywrightApi
|
24
33
|
|
25
34
|
# Returns locator to the first matching frame.
|
@@ -39,8 +48,8 @@ module Playwright
|
|
39
48
|
end
|
40
49
|
|
41
50
|
# The method finds an element matching the specified selector in the FrameLocator's subtree.
|
42
|
-
def locator(selector)
|
43
|
-
wrap_impl(@impl.locator(unwrap_impl(selector)))
|
51
|
+
def locator(selector, hasText: nil)
|
52
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), hasText: unwrap_impl(hasText)))
|
44
53
|
end
|
45
54
|
|
46
55
|
# Returns locator to the n-th matching frame.
|
@@ -1,49 +1,8 @@
|
|
1
1
|
module Playwright
|
2
|
-
#
|
3
|
-
#
|
2
|
+
# Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent a way
|
3
|
+
# to find element(s) on the page at any moment. Locator can be created with the [`method: Page.locator`] method.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
# locator = page.locator("text=Submit")
|
7
|
-
# locator.click()
|
8
|
-
# ```
|
9
|
-
#
|
10
|
-
# The difference between the Locator and `ElementHandle` is that the latter points to a particular element, while Locator
|
11
|
-
# captures the logic of how to retrieve that element.
|
12
|
-
#
|
13
|
-
# In the example below, handle points to a particular DOM element on page. If that element changes text or is used by
|
14
|
-
# React to render an entirely different component, handle is still pointing to that very DOM element. This can lead to
|
15
|
-
# unexpected behaviors.
|
16
|
-
#
|
17
|
-
# ```python sync
|
18
|
-
# handle = page.query_selector("text=Submit")
|
19
|
-
# handle.hover()
|
20
|
-
# handle.click()
|
21
|
-
# ```
|
22
|
-
#
|
23
|
-
# With the locator, every time the `element` is used, up-to-date DOM element is located in the page using the selector. So
|
24
|
-
# in the snippet below, underlying DOM element is going to be located twice.
|
25
|
-
#
|
26
|
-
# ```python sync
|
27
|
-
# locator = page.locator("text=Submit")
|
28
|
-
# locator.hover()
|
29
|
-
# locator.click()
|
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
|
-
#
|
44
|
-
# # Works because count knows what to do with multiple matches:
|
45
|
-
# page.locator('button').count()
|
46
|
-
# ```
|
5
|
+
# [Learn more about locators](./locators.md).
|
47
6
|
class Locator < PlaywrightApi
|
48
7
|
|
49
8
|
# Returns an array of `node.innerText` values for all matching nodes.
|
@@ -183,6 +142,17 @@ module Playwright
|
|
183
142
|
wrap_impl(@impl.dispatch_event(unwrap_impl(type), eventInit: unwrap_impl(eventInit), timeout: unwrap_impl(timeout)))
|
184
143
|
end
|
185
144
|
|
145
|
+
def drag_to(
|
146
|
+
target,
|
147
|
+
force: nil,
|
148
|
+
noWaitAfter: nil,
|
149
|
+
sourcePosition: nil,
|
150
|
+
targetPosition: nil,
|
151
|
+
timeout: nil,
|
152
|
+
trial: nil)
|
153
|
+
wrap_impl(@impl.drag_to(unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
154
|
+
end
|
155
|
+
|
186
156
|
# Resolves given locator to the first matching DOM element. If no elements matching the query are visible, waits for them
|
187
157
|
# up to a given timeout. If multiple elements match the selector, throws.
|
188
158
|
def element_handle(timeout: nil)
|
@@ -350,8 +320,8 @@ module Playwright
|
|
350
320
|
end
|
351
321
|
|
352
322
|
# The method finds an element matching the specified selector in the `Locator`'s subtree.
|
353
|
-
def locator(selector)
|
354
|
-
wrap_impl(@impl.locator(unwrap_impl(selector)))
|
323
|
+
def locator(selector, hasText: nil)
|
324
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), hasText: unwrap_impl(hasText)))
|
355
325
|
end
|
356
326
|
|
357
327
|
# Returns locator to the n-th matching element.
|
data/lib/playwright_api/page.rb
CHANGED
@@ -56,6 +56,11 @@ module Playwright
|
|
56
56
|
wrap_impl(@impl.mouse)
|
57
57
|
end
|
58
58
|
|
59
|
+
# API testing helper associated with this page. Requests made with this API will use page cookies.
|
60
|
+
def request # property
|
61
|
+
raise NotImplementedError.new('request is not implemented yet.')
|
62
|
+
end
|
63
|
+
|
59
64
|
def touchscreen # property
|
60
65
|
wrap_impl(@impl.touchscreen)
|
61
66
|
end
|
@@ -681,8 +686,8 @@ module Playwright
|
|
681
686
|
# different DOM elements. That would happen if the DOM structure between those actions has changed.
|
682
687
|
#
|
683
688
|
# Shortcut for main frame's [`method: Frame.locator`].
|
684
|
-
def locator(selector)
|
685
|
-
wrap_impl(@impl.locator(unwrap_impl(selector)))
|
689
|
+
def locator(selector, hasText: nil)
|
690
|
+
wrap_impl(@impl.locator(unwrap_impl(selector), hasText: unwrap_impl(hasText)))
|
686
691
|
end
|
687
692
|
|
688
693
|
# The page's main frame. Page is guaranteed to have a main frame which persists during navigations.
|
@@ -1381,11 +1386,6 @@ module Playwright
|
|
1381
1386
|
wrap_impl(@impl.owned_context=(unwrap_impl(req)))
|
1382
1387
|
end
|
1383
1388
|
|
1384
|
-
# @nodoc
|
1385
|
-
def request
|
1386
|
-
wrap_impl(@impl.request)
|
1387
|
-
end
|
1388
|
-
|
1389
1389
|
# @nodoc
|
1390
1390
|
def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
1391
1391
|
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
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.18.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YusukeIwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -210,9 +210,7 @@ files:
|
|
210
210
|
- documentation/README.md
|
211
211
|
- documentation/babel.config.js
|
212
212
|
- documentation/docs/api/accessibility.md
|
213
|
-
- documentation/docs/api/api_request.md
|
214
213
|
- documentation/docs/api/api_request_context.md
|
215
|
-
- documentation/docs/api/api_response.md
|
216
214
|
- documentation/docs/api/browser.md
|
217
215
|
- documentation/docs/api/browser_context.md
|
218
216
|
- documentation/docs/api/browser_type.md
|
@@ -277,7 +275,6 @@ files:
|
|
277
275
|
- lib/playwright/accessibility_impl.rb
|
278
276
|
- lib/playwright/android_input_impl.rb
|
279
277
|
- lib/playwright/api_implementation.rb
|
280
|
-
- lib/playwright/api_response_impl.rb
|
281
278
|
- lib/playwright/channel.rb
|
282
279
|
- lib/playwright/channel_owner.rb
|
283
280
|
- lib/playwright/channel_owners/android.rb
|
@@ -296,6 +293,7 @@ files:
|
|
296
293
|
- lib/playwright/channel_owners/fetch_request.rb
|
297
294
|
- lib/playwright/channel_owners/frame.rb
|
298
295
|
- lib/playwright/channel_owners/js_handle.rb
|
296
|
+
- lib/playwright/channel_owners/local_utils.rb
|
299
297
|
- lib/playwright/channel_owners/page.rb
|
300
298
|
- lib/playwright/channel_owners/playwright.rb
|
301
299
|
- lib/playwright/channel_owners/request.rb
|
@@ -343,9 +341,7 @@ files:
|
|
343
341
|
- lib/playwright_api/android_input.rb
|
344
342
|
- lib/playwright_api/android_socket.rb
|
345
343
|
- lib/playwright_api/android_web_view.rb
|
346
|
-
- lib/playwright_api/api_request.rb
|
347
344
|
- lib/playwright_api/api_request_context.rb
|
348
|
-
- lib/playwright_api/api_response.rb
|
349
345
|
- lib/playwright_api/browser.rb
|
350
346
|
- lib/playwright_api/browser_context.rb
|
351
347
|
- lib/playwright_api/browser_type.rb
|
@@ -359,6 +355,7 @@ files:
|
|
359
355
|
- lib/playwright_api/frame_locator.rb
|
360
356
|
- lib/playwright_api/js_handle.rb
|
361
357
|
- lib/playwright_api/keyboard.rb
|
358
|
+
- lib/playwright_api/local_utils.rb
|
362
359
|
- lib/playwright_api/locator.rb
|
363
360
|
- lib/playwright_api/mouse.rb
|
364
361
|
- lib/playwright_api/page.rb
|
@@ -387,12 +384,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
387
384
|
version: '2.4'
|
388
385
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
389
386
|
requirements:
|
390
|
-
- - "
|
387
|
+
- - ">"
|
391
388
|
- !ruby/object:Gem::Version
|
392
|
-
version:
|
389
|
+
version: 1.3.1
|
393
390
|
requirements: []
|
394
391
|
rubygems_version: 3.3.3
|
395
392
|
signing_key:
|
396
393
|
specification_version: 4
|
397
|
-
summary: The Ruby binding of playwright driver 1.
|
394
|
+
summary: The Ruby binding of playwright driver 1.18.0
|
398
395
|
test_files: []
|