playwright-ruby-client 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/playwright.rb +2 -0
  3. data/lib/playwright/channel_owners/element_handle.rb +75 -0
  4. data/lib/playwright/channel_owners/frame.rb +117 -0
  5. data/lib/playwright/channel_owners/page.rb +68 -11
  6. data/lib/playwright/channel_owners/request.rb +90 -0
  7. data/lib/playwright/input_type.rb +19 -0
  8. data/lib/playwright/input_types/keyboard.rb +32 -0
  9. data/lib/playwright/input_types/mouse.rb +4 -0
  10. data/lib/playwright/input_types/touchscreen.rb +4 -0
  11. data/lib/playwright/javascript/expression.rb +22 -0
  12. data/lib/playwright/javascript/function.rb +22 -0
  13. data/lib/playwright/playwright_api.rb +31 -23
  14. data/lib/playwright/timeout_settings.rb +1 -1
  15. data/lib/playwright/url_matcher.rb +19 -0
  16. data/lib/playwright/version.rb +1 -1
  17. data/lib/playwright_api/accessibility.rb +46 -6
  18. data/lib/playwright_api/binding_call.rb +6 -6
  19. data/lib/playwright_api/browser.rb +76 -16
  20. data/lib/playwright_api/browser_context.rb +284 -30
  21. data/lib/playwright_api/browser_type.rb +54 -9
  22. data/lib/playwright_api/cdp_session.rb +23 -1
  23. data/lib/playwright_api/chromium_browser_context.rb +16 -6
  24. data/lib/playwright_api/console_message.rb +10 -10
  25. data/lib/playwright_api/dialog.rb +42 -0
  26. data/lib/playwright_api/download.rb +19 -4
  27. data/lib/playwright_api/element_handle.rb +174 -21
  28. data/lib/playwright_api/file_chooser.rb +8 -0
  29. data/lib/playwright_api/frame.rb +355 -68
  30. data/lib/playwright_api/js_handle.rb +45 -9
  31. data/lib/playwright_api/keyboard.rb +98 -8
  32. data/lib/playwright_api/mouse.rb +22 -0
  33. data/lib/playwright_api/page.rb +779 -127
  34. data/lib/playwright_api/playwright.rb +98 -19
  35. data/lib/playwright_api/request.rb +70 -23
  36. data/lib/playwright_api/response.rb +6 -6
  37. data/lib/playwright_api/route.rb +48 -0
  38. data/lib/playwright_api/selectors.rb +14 -6
  39. data/lib/playwright_api/video.rb +8 -0
  40. data/lib/playwright_api/web_socket.rb +3 -5
  41. data/lib/playwright_api/worker.rb +12 -0
  42. metadata +7 -2
@@ -40,26 +40,34 @@ module Playwright
40
40
  # await browser.close();
41
41
  # })();
42
42
  # ```
43
+ #
44
+ # ```python async
45
+ # # FIXME: add snippet
46
+ # ```
47
+ #
48
+ # ```python sync
49
+ # # FIXME: add snippet
50
+ # ```
43
51
  def register(name, script, contentScript: nil)
44
52
  raise NotImplementedError.new('register is not implemented yet.')
45
53
  end
46
54
 
47
55
  # -- inherited from EventEmitter --
48
56
  # @nodoc
49
- def off(event, callback)
50
- wrap_channel_owner(@channel_owner.off(event, callback))
57
+ def on(event, callback)
58
+ wrap_impl(@impl.on(event, callback))
51
59
  end
52
60
 
53
61
  # -- inherited from EventEmitter --
54
62
  # @nodoc
55
- def once(event, callback)
56
- wrap_channel_owner(@channel_owner.once(event, callback))
63
+ def off(event, callback)
64
+ wrap_impl(@impl.off(event, callback))
57
65
  end
58
66
 
59
67
  # -- inherited from EventEmitter --
60
68
  # @nodoc
61
- def on(event, callback)
62
- wrap_channel_owner(@channel_owner.on(event, callback))
69
+ def once(event, callback)
70
+ wrap_impl(@impl.once(event, callback))
63
71
  end
64
72
  end
65
73
  end
@@ -5,6 +5,14 @@ module Playwright
5
5
  # ```js
6
6
  # console.log(await page.video().path());
7
7
  # ```
8
+ #
9
+ # ```python async
10
+ # print(await page.video.path())
11
+ # ```
12
+ #
13
+ # ```python sync
14
+ # print(page.video.path())
15
+ # ```
8
16
  class Video < PlaywrightApi
9
17
 
10
18
  # Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem
@@ -12,12 +12,10 @@ module Playwright
12
12
  raise NotImplementedError.new('url is not implemented yet.')
13
13
  end
14
14
 
15
- # Returns the event data value.
16
- #
17
15
  # Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
18
- # value. Will throw an error if the webSocket is closed before the event is fired.
19
- def wait_for_event(event, optionsOrPredicate: nil)
20
- raise NotImplementedError.new('wait_for_event is not implemented yet.')
16
+ # value. Will throw an error if the webSocket is closed before the event is fired. Returns the event data value.
17
+ def expect_event(event, optionsOrPredicate: nil)
18
+ raise NotImplementedError.new('expect_event is not implemented yet.')
21
19
  end
22
20
  end
23
21
  end
@@ -14,6 +14,18 @@ module Playwright
14
14
  # for (const worker of page.workers())
15
15
  # console.log(' ' + worker.url());
16
16
  # ```
17
+ #
18
+ # ```py
19
+ # def handle_worker(worker):
20
+ # print("worker created: " + worker.url)
21
+ # worker.on("close", lambda: print("worker destroyed: " + worker.url))
22
+ #
23
+ # page.on('worker', handle_worker)
24
+ #
25
+ # print("current workers:")
26
+ # for worker in page.workers:
27
+ # print(" " + worker.url)
28
+ # ```
17
29
  class Worker < PlaywrightApi
18
30
 
19
31
  # Returns the return value of `pageFunction`
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.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-23 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -191,6 +191,10 @@ files:
191
191
  - lib/playwright/errors.rb
192
192
  - lib/playwright/event_emitter.rb
193
193
  - lib/playwright/events.rb
194
+ - lib/playwright/input_type.rb
195
+ - lib/playwright/input_types/keyboard.rb
196
+ - lib/playwright/input_types/mouse.rb
197
+ - lib/playwright/input_types/touchscreen.rb
194
198
  - lib/playwright/javascript.rb
195
199
  - lib/playwright/javascript/expression.rb
196
200
  - lib/playwright/javascript/function.rb
@@ -199,6 +203,7 @@ files:
199
203
  - lib/playwright/playwright_api.rb
200
204
  - lib/playwright/timeout_settings.rb
201
205
  - lib/playwright/transport.rb
206
+ - lib/playwright/url_matcher.rb
202
207
  - lib/playwright/utils.rb
203
208
  - lib/playwright/version.rb
204
209
  - lib/playwright/wait_helper.rb