playwright-ruby-client 1.55.0 → 1.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +5 -0
- data/README.md +4 -0
- data/documentation/docs/api/browser_context.md +6 -2
- data/documentation/docs/api/page.md +31 -0
- data/documentation/docs/include/api_coverage.md +3 -0
- data/documentation/package.json +3 -3
- data/documentation/yarn.lock +12372 -8623
- data/lib/playwright/channel_owners/browser_context.rb +3 -15
- data/lib/playwright/channel_owners/page.rb +20 -1
- data/lib/playwright/console_message_impl.rb +3 -2
- data/lib/playwright/locator_assertions_impl.rb +5 -2
- data/lib/playwright/page_assertions_impl.rb +5 -2
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/browser_context.rb +2 -2
- data/lib/playwright_api/locator.rb +1 -1
- data/lib/playwright_api/page.rb +27 -5
- data/lib/playwright_api/worker.rb +4 -4
- data/sig/playwright.rbs +3 -0
- metadata +3 -2
|
@@ -14,7 +14,6 @@ module Playwright
|
|
|
14
14
|
@bindings = {}
|
|
15
15
|
@timeout_settings = TimeoutSettings.new
|
|
16
16
|
@service_workers = Set.new
|
|
17
|
-
@background_pages = Set.new
|
|
18
17
|
@owner_page = nil
|
|
19
18
|
|
|
20
19
|
@tracing = ChannelOwners::Tracing.from(@initializer['tracing'])
|
|
@@ -27,14 +26,11 @@ module Playwright
|
|
|
27
26
|
@channel.once('close', ->(_) { on_close })
|
|
28
27
|
@channel.on('page', ->(params) { on_page(ChannelOwners::Page.from(params['page']) )})
|
|
29
28
|
@channel.on('route', ->(params) { on_route(ChannelOwners::Route.from(params['route'])) })
|
|
30
|
-
@channel.on('backgroundPage', ->(params) {
|
|
31
|
-
on_background_page(ChannelOwners::Page.from(params['page']))
|
|
32
|
-
})
|
|
33
29
|
@channel.on('serviceWorker', ->(params) {
|
|
34
30
|
on_service_worker(ChannelOwners::Worker.from(params['worker']))
|
|
35
31
|
})
|
|
36
32
|
@channel.on('console', ->(params) {
|
|
37
|
-
on_console_message(ConsoleMessageImpl.new(params))
|
|
33
|
+
on_console_message(ConsoleMessageImpl.new(params, ChannelOwners::Page.from_nullable(params['page'])))
|
|
38
34
|
})
|
|
39
35
|
@channel.on('pageError', ->(params) {
|
|
40
36
|
on_page_error(
|
|
@@ -104,11 +100,6 @@ module Playwright
|
|
|
104
100
|
page.send(:emit_popup_event_from_browser_context)
|
|
105
101
|
end
|
|
106
102
|
|
|
107
|
-
private def on_background_page(page)
|
|
108
|
-
@background_pages << page
|
|
109
|
-
emit(Events::BrowserContext::BackgroundPage, page)
|
|
110
|
-
end
|
|
111
|
-
|
|
112
103
|
private def on_route(route)
|
|
113
104
|
route.send(:update_context, self)
|
|
114
105
|
|
|
@@ -216,7 +207,8 @@ module Playwright
|
|
|
216
207
|
end
|
|
217
208
|
|
|
218
209
|
def background_pages
|
|
219
|
-
|
|
210
|
+
puts '[WARNING] BrowserContext#background_pages is deprecated. Returns an empty list.'
|
|
211
|
+
[]
|
|
220
212
|
end
|
|
221
213
|
|
|
222
214
|
def service_workers
|
|
@@ -543,10 +535,6 @@ module Playwright
|
|
|
543
535
|
@pages.delete(page)
|
|
544
536
|
end
|
|
545
537
|
|
|
546
|
-
private def remove_background_page(page)
|
|
547
|
-
@background_pages.delete(page)
|
|
548
|
-
end
|
|
549
|
-
|
|
550
538
|
private def remove_service_worker(worker)
|
|
551
539
|
@service_workers.delete(worker)
|
|
552
540
|
end
|
|
@@ -149,7 +149,6 @@ module Playwright
|
|
|
149
149
|
private def on_close
|
|
150
150
|
@closed = true
|
|
151
151
|
@browser_context.send(:remove_page, self)
|
|
152
|
-
@browser_context.send(:remove_background_page, self)
|
|
153
152
|
if @closed_or_crashed_promise.pending?
|
|
154
153
|
@closed_or_crashed_promise.fulfill(close_error_with_reason)
|
|
155
154
|
end
|
|
@@ -639,6 +638,20 @@ module Playwright
|
|
|
639
638
|
timeout: timeout)
|
|
640
639
|
end
|
|
641
640
|
|
|
641
|
+
def console_messages
|
|
642
|
+
messages = @channel.send_message_to_server('consoleMessages')
|
|
643
|
+
messages.map do |message|
|
|
644
|
+
ConsoleMessageImpl.new(message, self)
|
|
645
|
+
end
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
def page_errors
|
|
649
|
+
errors = @channel.send_message_to_server('pageErrors')
|
|
650
|
+
errors.map do |error|
|
|
651
|
+
Error.parse(error['error'])
|
|
652
|
+
end
|
|
653
|
+
end
|
|
654
|
+
|
|
642
655
|
def locator(
|
|
643
656
|
selector,
|
|
644
657
|
has: nil,
|
|
@@ -826,6 +839,12 @@ module Playwright
|
|
|
826
839
|
@workers.to_a
|
|
827
840
|
end
|
|
828
841
|
|
|
842
|
+
def requests
|
|
843
|
+
@channel.send_message_to_server('requests').map do |req|
|
|
844
|
+
ChannelOwners::Request.from(req)
|
|
845
|
+
end
|
|
846
|
+
end
|
|
847
|
+
|
|
829
848
|
def request
|
|
830
849
|
@browser_context.request
|
|
831
850
|
end
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
module Playwright
|
|
2
2
|
define_api_implementation :ConsoleMessageImpl do
|
|
3
|
-
def initialize(event)
|
|
3
|
+
def initialize(event, page)
|
|
4
4
|
@event = event
|
|
5
|
+
@page = page
|
|
5
6
|
end
|
|
6
7
|
|
|
7
8
|
def page
|
|
8
|
-
@page
|
|
9
|
+
@page
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def type
|
|
@@ -49,8 +49,11 @@ module Playwright
|
|
|
49
49
|
"\n#{message}"
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if result['errorMessage']
|
|
53
|
+
error_message = "\n#{result['errorMessage']}"
|
|
54
|
+
end
|
|
55
|
+
out = "#{out_message}\nActual value #{actual}#{error_message} #{log}"
|
|
56
|
+
raise AssertionError.new(out)
|
|
54
57
|
else
|
|
55
58
|
true
|
|
56
59
|
end
|
|
@@ -50,8 +50,11 @@ module Playwright
|
|
|
50
50
|
"\n#{message}"
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
if result['errorMessage']
|
|
54
|
+
error_message = "\n#{result['errorMessage']}"
|
|
55
|
+
end
|
|
56
|
+
out = "#{out_message}\nActual value #{actual}#{error_message} #{log}"
|
|
57
|
+
raise AssertionError.new(out)
|
|
55
58
|
else
|
|
56
59
|
true
|
|
57
60
|
end
|
data/lib/playwright/version.rb
CHANGED
|
@@ -72,9 +72,9 @@ module Playwright
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
#
|
|
75
|
-
#
|
|
75
|
+
# Returns an empty list.
|
|
76
76
|
#
|
|
77
|
-
#
|
|
77
|
+
# @deprecated Background pages have been removed from Chromium together with Manifest V2 extensions.
|
|
78
78
|
def background_pages
|
|
79
79
|
wrap_impl(@impl.background_pages)
|
|
80
80
|
end
|
|
@@ -61,7 +61,7 @@ module Playwright
|
|
|
61
61
|
# The following example finds a button with a specific title.
|
|
62
62
|
#
|
|
63
63
|
# ```python sync
|
|
64
|
-
# button = page.get_by_role("button").and_(page.
|
|
64
|
+
# button = page.get_by_role("button").and_(page.get_by_title("Subscribe"))
|
|
65
65
|
# ```
|
|
66
66
|
def and(locator)
|
|
67
67
|
wrap_impl(@impl.and(unwrap_impl(locator)))
|
data/lib/playwright_api/page.rb
CHANGED
|
@@ -922,6 +922,18 @@ module Playwright
|
|
|
922
922
|
wrap_impl(@impl.visible?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
|
923
923
|
end
|
|
924
924
|
|
|
925
|
+
#
|
|
926
|
+
# Returns up to (currently) 200 last console messages from this page. See [`event: Page.console`] for more details.
|
|
927
|
+
def console_messages
|
|
928
|
+
wrap_impl(@impl.console_messages)
|
|
929
|
+
end
|
|
930
|
+
|
|
931
|
+
#
|
|
932
|
+
# Returns up to (currently) 200 last page errors from this page. See [`event: Page.pageError`] for more details.
|
|
933
|
+
def page_errors
|
|
934
|
+
wrap_impl(@impl.page_errors)
|
|
935
|
+
end
|
|
936
|
+
|
|
925
937
|
#
|
|
926
938
|
# The method returns an element locator that can be used to perform actions on this page / frame.
|
|
927
939
|
# Locator is resolved to the element immediately before performing an action, so a series of actions on the same locator can in fact be performed on different DOM elements. That would happen if the DOM structure between those actions has changed.
|
|
@@ -1085,6 +1097,16 @@ module Playwright
|
|
|
1085
1097
|
wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
|
|
1086
1098
|
end
|
|
1087
1099
|
|
|
1100
|
+
#
|
|
1101
|
+
# Returns up to (currently) 100 last network request from this page. See [`event: Page.request`] for more details.
|
|
1102
|
+
#
|
|
1103
|
+
# Returned requests should be accessed immediately, otherwise they might be collected to prevent unbounded memory growth as new requests come in. Once collected, retrieving most information about the request is impossible.
|
|
1104
|
+
#
|
|
1105
|
+
# Note that requests reported through the [`event: Page.request`] request are not collected, so there is a trade off between efficient memory usage with [`method: Page.requests`] and the amount of available information reported through [`event: Page.request`].
|
|
1106
|
+
def requests
|
|
1107
|
+
wrap_impl(@impl.requests)
|
|
1108
|
+
end
|
|
1109
|
+
|
|
1088
1110
|
#
|
|
1089
1111
|
# When testing a web page, sometimes unexpected overlays like a "Sign up" dialog appear and block actions you want to automate, e.g. clicking a button. These overlays don't always show up in the same way or at the same time, making them tricky to handle in automated tests.
|
|
1090
1112
|
#
|
|
@@ -1813,11 +1835,6 @@ module Playwright
|
|
|
1813
1835
|
wrap_impl(@impl.stop_js_coverage)
|
|
1814
1836
|
end
|
|
1815
1837
|
|
|
1816
|
-
# @nodoc
|
|
1817
|
-
def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
1818
|
-
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
|
1819
|
-
end
|
|
1820
|
-
|
|
1821
1838
|
# @nodoc
|
|
1822
1839
|
def stop_css_coverage
|
|
1823
1840
|
wrap_impl(@impl.stop_css_coverage)
|
|
@@ -1828,6 +1845,11 @@ module Playwright
|
|
|
1828
1845
|
wrap_impl(@impl.owned_context=(unwrap_impl(req)))
|
|
1829
1846
|
end
|
|
1830
1847
|
|
|
1848
|
+
# @nodoc
|
|
1849
|
+
def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
1850
|
+
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
|
1851
|
+
end
|
|
1852
|
+
|
|
1831
1853
|
# -- inherited from EventEmitter --
|
|
1832
1854
|
# @nodoc
|
|
1833
1855
|
def once(event, callback)
|
|
@@ -47,13 +47,13 @@ module Playwright
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
# @nodoc
|
|
50
|
-
def
|
|
51
|
-
wrap_impl(@impl.
|
|
50
|
+
def context=(req)
|
|
51
|
+
wrap_impl(@impl.context=(unwrap_impl(req)))
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# @nodoc
|
|
55
|
-
def
|
|
56
|
-
wrap_impl(@impl.
|
|
55
|
+
def page=(req)
|
|
56
|
+
wrap_impl(@impl.page=(unwrap_impl(req)))
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
# -- inherited from EventEmitter --
|
data/sig/playwright.rbs
CHANGED
|
@@ -311,6 +311,8 @@ module Playwright
|
|
|
311
311
|
def enabled?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
|
312
312
|
def hidden?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
|
313
313
|
def visible?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
|
314
|
+
def console_messages: -> Array[untyped]
|
|
315
|
+
def page_errors: -> Array[untyped]
|
|
314
316
|
def locator: (String selector, ?has: Locator, ?hasNot: Locator, ?hasNotText: (String | Regexp), ?hasText: (String | Regexp)) -> Locator
|
|
315
317
|
def main_frame: -> Frame
|
|
316
318
|
def opener: -> (nil | Page)
|
|
@@ -319,6 +321,7 @@ module Playwright
|
|
|
319
321
|
def press: (String selector, String key, ?delay: Float, ?noWaitAfter: bool, ?strict: bool, ?timeout: Float) -> void
|
|
320
322
|
def query_selector: (String selector, ?strict: bool) -> (nil | ElementHandle)
|
|
321
323
|
def query_selector_all: (String selector) -> Array[untyped]
|
|
324
|
+
def requests: -> Array[untyped]
|
|
322
325
|
def reload: (?timeout: Float, ?waitUntil: ("load" | "domcontentloaded" | "networkidle" | "commit")) -> (nil | Response)
|
|
323
326
|
def route: ((String | Regexp | function) url, function handler, ?times: Integer) -> void
|
|
324
327
|
def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?updateContent: ("embed" | "attach"), ?updateMode: ("full" | "minimal"), ?url: (String | Regexp)) -> void
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.56.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- YusukeIwaki
|
|
@@ -199,6 +199,7 @@ extra_rdoc_files: []
|
|
|
199
199
|
files:
|
|
200
200
|
- ".rspec"
|
|
201
201
|
- CODE_OF_CONDUCT.md
|
|
202
|
+
- CONTRIBUTING.md
|
|
202
203
|
- Gemfile
|
|
203
204
|
- LICENSE.txt
|
|
204
205
|
- README.md
|
|
@@ -409,5 +410,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
409
410
|
requirements: []
|
|
410
411
|
rubygems_version: 3.6.9
|
|
411
412
|
specification_version: 4
|
|
412
|
-
summary: The Ruby binding of playwright driver 1.
|
|
413
|
+
summary: The Ruby binding of playwright driver 1.56.1
|
|
413
414
|
test_files: []
|