puppeteer-ruby 0.35.0 → 0.37.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7386b90fffcd353eb933d6dcb35d1e7cab9482fa70eaa536bf7bd19bba594edf
4
- data.tar.gz: a4bad8a9ab93025fd2864e2a4cd4ff9c6e972156a19898f6cefab84397a9526e
3
+ metadata.gz: 56a2cd3d9440bce6f77f2a072e8c8e7ea83fdd3d65a7e85e1887f7f7dd4481ce
4
+ data.tar.gz: 337c5cd7e4c23bd5e3c154bbaaae229d4285c8ba491ca427197ee7449c1f1849
5
5
  SHA512:
6
- metadata.gz: d884728c758d4109ac19e72845a36677186b02d723f1be5e5dc5f5e7eb688b7e87ec17d134a1c02818a68273eeb5aaa49759f2b8554a2200ab1ea7a149c9df7a
7
- data.tar.gz: 2fb46af25d069bd75411abc56a5787b04ba0d2af000c06a046df2f300b096c191978628ed5d68d12653dd8b61bb2131008da90baaf0a190942caa10daf9f6cdc
6
+ metadata.gz: '005883b864a160d29a8879a8d54945edbce02f6d1b80a0f8816d84244b46c62d11417e2bcf2bc67e8b7f7a4486dc201ecb2961070fe875fc948be0483be8bcee'
7
+ data.tar.gz: 1a7cd9d0c2aacde091d0f6d0738c61e4a28a96830f2b65dae8e6e84fd3c190ea69bf8e964748d61020f264bfcbc25901e4e1895289b1a98a7d5452c03e2647de
data/CHANGELOG.md CHANGED
@@ -1,36 +1,63 @@
1
- ### master [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.35.0...master)]
1
+ ### master [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.37.1...master)]
2
2
 
3
- * xxx
3
+ - xxx
4
+
5
+ ### 0.37.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.37.0...0.37.1)]
6
+
7
+ Bugfix:
8
+
9
+ - Fix handle_SIGINT, handle_SIGTERM, handle_SIGHUP options to work with `false` value specified.
10
+
11
+ ### 0.37.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.36.0...0.37.0)]
12
+
13
+ New features:
14
+
15
+ - Some features introduced in Puppeteer 10.4
16
+
17
+ ### 0.36.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.35.1...0.36.0)]
18
+
19
+ New features:
20
+
21
+ - Drag and Drop feature introduced in Puppeteer 10.1
22
+ - `Page#emulateNetworkConditions`, `Page#emulateCPUThrottling`
23
+ - `Page#exposeFunction`
24
+ - Metrics
25
+
26
+ ### 0.35.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.35.0...0.35.1)]
27
+
28
+ New features:
29
+
30
+ - Allow Rails users to use this library without `require 'puppeteer'`.
4
31
 
5
32
  ### 0.35.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.34.3...0.35.0)]
6
33
 
7
34
  New features:
8
35
 
9
- * Add `channel` parameter for Puppeteer.launch. Now `channel: chrome` or `channel: chrome-canary` (chrome-beta, chrome-dev is also available) automatically detects the executablePath of Google Chrome. Windows/macOS users can also use `channel: msedge`.
36
+ - Add `channel` parameter for Puppeteer.launch. Now `channel: chrome` or `channel: chrome-canary` (chrome-beta, chrome-dev is also available) automatically detects the executablePath of Google Chrome. Windows/macOS users can also use `channel: msedge`.
10
37
 
11
38
  ### 0.34.3 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.34.2...0.34.3)]
12
39
 
13
40
  Bugfix:
14
41
 
15
- * Fix wait_for_xxx's timeout error type.
42
+ - Fix wait_for_xxx's timeout error type.
16
43
 
17
44
  ### 0.34.2 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.34.1...0.34.2)]
18
45
 
19
46
  New features:
20
47
 
21
- * Add `Page#bring_to_front`.
48
+ - Add `Page#bring_to_front`.
22
49
 
23
50
  ### 0.34.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.34.0...0.34.1)]
24
51
 
25
52
  Bugfix:
26
53
 
27
- * Fix `Page#pdf` to work without `path` parameter.
54
+ - Fix `Page#pdf` to work without `path` parameter.
28
55
 
29
56
  ### 0.34.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.33.0...0.34.0)]
30
57
 
31
58
  New features:
32
59
 
33
- * Sync API with block
60
+ - Sync API with block
34
61
 
35
62
  ### 0.33.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.4...0.33.0)]
36
63
 
@@ -38,170 +65,169 @@ NOTE: Requires Ruby version >= 2.6 explicitly since this version.
38
65
 
39
66
  Bugfix:
40
67
 
41
- * Fix PDF options to work correctly on decimal numbers specified.
68
+ - Fix PDF options to work correctly on decimal numbers specified.
42
69
 
43
70
  ### 0.32.4 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.3...0.32.4)]
44
71
 
45
72
  Bugfix:
46
73
 
47
- * Fix `#type_text` to input '<' correctly.
74
+ - Fix `#type_text` to input '<' correctly.
48
75
 
49
76
  ### 0.32.3 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.2...0.32.3)]
50
77
 
51
78
  Bugfix:
52
79
 
53
- * Fix puppeteer-ruby to work on Rails in development mode.
54
-
80
+ - Fix puppeteer-ruby to work on Rails in development mode.
55
81
 
56
82
  ### 0.32.2 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.1...0.32.2)]
57
83
 
58
84
  Bugfix:
59
85
 
60
- * Fix full_page option in screenshot.
86
+ - Fix full_page option in screenshot.
61
87
 
62
88
  ### 0.32.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.32.0...0.32.1)]
63
89
 
64
90
  Bugfix:
65
91
 
66
- * Fix WebSocket to work with `wss://...` endpoint (ex. browserless.io)
92
+ - Fix WebSocket to work with `wss://...` endpoint (ex. browserless.io)
67
93
 
68
94
  ### 0.32.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.6...0.32.0)]
69
95
 
70
96
  New features:
71
97
 
72
- * Tracing
73
- * JS/CSS coverages
98
+ - Tracing
99
+ - JS/CSS coverages
74
100
 
75
101
  Improvement:
76
102
 
77
- * Increase stability [#92](https://github.com/YusukeIwaki/puppeteer-ruby/pull/92)
103
+ - Increase stability [#92](https://github.com/YusukeIwaki/puppeteer-ruby/pull/92)
78
104
 
79
105
  ### 0.31.6 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.5...0.31.6)]
80
106
 
81
107
  Improvement:
82
108
 
83
- * Increase stability [#87](https://github.com/YusukeIwaki/puppeteer-ruby/pull/87)
109
+ - Increase stability [#87](https://github.com/YusukeIwaki/puppeteer-ruby/pull/87)
84
110
 
85
111
  ### 0.31.5 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.4...0.31.5)]
86
112
 
87
113
  Bugfix:
88
114
 
89
- * Fix file uploading to work without crash.
115
+ - Fix file uploading to work without crash.
90
116
 
91
117
  ### 0.31.4 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.3...0.31.4)]
92
118
 
93
119
  Bugfix:
94
120
 
95
- * Fix PDF options (format, margin, omit_background) to work.
121
+ - Fix PDF options (format, margin, omit_background) to work.
96
122
 
97
123
  ### 0.31.3 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.1...0.31.3)]
98
124
 
99
125
  Bugfix:
100
126
 
101
- * Fix `wait_for_selector` to work. *It is strongly recommended to update for 0.29.0-0.31.x users.*
127
+ - Fix `wait_for_selector` to work. _It is strongly recommended to update for 0.29.0-0.31.x users._
102
128
 
103
129
  ### 0.31.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.31.0...0.31.1)]
104
130
 
105
131
  Bugfix:
106
132
 
107
- * Fix `Page#pdf` to work on Windows.
133
+ - Fix `Page#pdf` to work on Windows.
108
134
 
109
135
  ### 0.31.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.30.0...0.31.0)]
110
136
 
111
137
  New features:
112
138
 
113
- * Now puppeteer-ruby is compatible with Windows
139
+ - Now puppeteer-ruby is compatible with Windows
114
140
 
115
141
  Bugfix:
116
142
 
117
- * Fix `Page#add_script_tag` and `Page#add_style_tag` to work
143
+ - Fix `Page#add_script_tag` and `Page#add_style_tag` to work
118
144
 
119
145
  ### 0.30.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.29.0...0.30.0)]
120
146
 
121
147
  New features:
122
148
 
123
- * S, SS, Seval, SSeval is renamed to query_selector, query_selector_all, eval_on_selector, eval_on_selector_all
149
+ - S, SS, Seval, SSeval is renamed to query_selector, query_selector_all, eval_on_selector, eval_on_selector_all
124
150
 
125
151
  ### 0.29.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.28.1...0.29.0)]
126
152
 
127
153
  New features:
128
154
 
129
- * Add `AriaQueryHandler`. Now we can use "aria/...." for selectors.
155
+ - Add `AriaQueryHandler`. Now we can use "aria/...." for selectors.
130
156
 
131
157
  ### 0.28.1 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.27...0.28.1)]
132
158
 
133
159
  New features:
134
160
 
135
- * Add `Page#emulate_idle_state`
136
- * Change versioning rule.
161
+ - Add `Page#emulate_idle_state`
162
+ - Change versioning rule.
137
163
 
138
164
  ### 0.0.27 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.26...0.0.27)]
139
165
 
140
166
  New features:
141
167
 
142
- * Now puppeteer-ruby is Ruby 3.0 compatible!
168
+ - Now puppeteer-ruby is Ruby 3.0 compatible!
143
169
 
144
170
  ### 0.0.26 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.25...0.0.26)]
145
171
 
146
172
  Bugfix:
147
173
 
148
- * Fix `Page#screenshot` working correctly with `quality` parameter.
174
+ - Fix `Page#screenshot` working correctly with `quality` parameter.
149
175
 
150
176
  ### 0.0.25 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.23...0.0.25)]
151
177
 
152
178
  New feature:
153
179
 
154
- * **Cookie** feature: `Page#set_cookie`, `Page#cookies`
180
+ - **Cookie** feature: `Page#set_cookie`, `Page#cookies`
155
181
 
156
182
  ### 0.0.23 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.22...0.0.23)]
157
183
 
158
184
  New feature:
159
185
 
160
- * **GeoLocation** feature
161
- * grant/clear permission
186
+ - **GeoLocation** feature
187
+ - grant/clear permission
162
188
 
163
189
  Bugfix/Improvement:
164
190
 
165
- * Refactoring for events ([#31](https://github.com/YusukeIwaki/puppeteer-ruby/pull/31))
166
- * Improve SEND/RECV handling in CDPSession ([#34](https://github.com/YusukeIwaki/puppeteer-ruby/pull/34))
191
+ - Refactoring for events ([#31](https://github.com/YusukeIwaki/puppeteer-ruby/pull/31))
192
+ - Improve SEND/RECV handling in CDPSession ([#34](https://github.com/YusukeIwaki/puppeteer-ruby/pull/34))
167
193
 
168
194
  ### 0.0.22 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.21...0.0.22)]
169
195
 
170
196
  Bugfix
171
197
 
172
- * Make `Puppeteer#default_args` to work
173
- * Respect Firefox launch options
174
- * Respect `default_viewport: nil`
198
+ - Make `Puppeteer#default_args` to work
199
+ - Respect Firefox launch options
200
+ - Respect `default_viewport: nil`
175
201
 
176
202
  ### 0.0.21 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.20...0.0.21)]
177
203
 
178
204
  Bugfix/Improvement:
179
205
 
180
- * Update DeviceDescriptors (list of emulatable devices)
181
- * Fix bug on inputing "(" ([#25](https://github.com/YusukeIwaki/puppeteer-ruby/pull/25))
206
+ - Update DeviceDescriptors (list of emulatable devices)
207
+ - Fix bug on inputing "(" ([#25](https://github.com/YusukeIwaki/puppeteer-ruby/pull/25))
182
208
 
183
209
  ### 0.0.20 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.19...0.0.20)]
184
210
 
185
211
  New feature
186
212
 
187
- * Dialog-handling feature
213
+ - Dialog-handling feature
188
214
 
189
215
  ### 0.0.19 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.18...0.0.19)]
190
216
 
191
217
  New feature
192
218
 
193
- * **Firefox support**
219
+ - **Firefox support**
194
220
 
195
221
  Bugfix/Improvement
196
222
 
197
- * Allow `Page#keyboard` with block ([#18](https://github.com/YusukeIwaki/puppeteer-ruby/pull/18))
223
+ - Allow `Page#keyboard` with block ([#18](https://github.com/YusukeIwaki/puppeteer-ruby/pull/18))
198
224
 
199
225
  ### 0.0.18 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.0.17...0.0.18)]
200
226
 
201
227
  New feature
202
228
 
203
- * **Firefox support**
229
+ - **Firefox support**
204
230
 
205
231
  Bugfix/Improvement
206
232
 
207
- * Allow `Page#keyboard` with block ([#18](https://github.com/YusukeIwaki/puppeteer-ruby/pull/18))
233
+ - Allow `Page#keyboard` with block ([#18](https://github.com/YusukeIwaki/puppeteer-ruby/pull/18))
data/README.md CHANGED
@@ -20,31 +20,29 @@ gem 'puppeteer-ruby'
20
20
 
21
21
  And then execute:
22
22
 
23
- $ bundle
24
-
25
- Or install it yourself as:
26
-
27
- $ gem install puppeteer-ruby
23
+ $ bundle install
28
24
 
29
25
  ### Capture a site
30
26
 
31
27
  ```ruby
32
- require 'puppeteer'
28
+ require 'puppeteer-ruby'
33
29
 
34
30
  Puppeteer.launch(headless: false) do |browser|
35
- page = browser.pages.first || browser.new_page
31
+ page = browser.new_page
36
32
  page.goto("https://github.com/YusukeIwaki")
37
33
  page.screenshot(path: "YusukeIwaki.png")
38
34
  end
39
35
  ```
40
36
 
37
+ NOTE: `require 'puppeteer-ruby'` is not necessary in Rails.
38
+
41
39
  ### Simple scraping
42
40
 
43
41
  ```ruby
44
- require 'puppeteer'
42
+ require 'puppeteer-ruby'
45
43
 
46
44
  Puppeteer.launch(headless: false, slow_mo: 50, args: ['--guest', '--window-size=1280,800']) do |browser|
47
- page = browser.pages.first || browser.new_page
45
+ page = browser.new_page
48
46
  page.viewport = Puppeteer::Viewport.new(width: 1280, height: 800)
49
47
  page.goto("https://github.com/", wait_until: 'domcontentloaded')
50
48
 
@@ -69,10 +67,10 @@ end
69
67
  ### Evaluate JavaScript
70
68
 
71
69
  ```ruby
72
- require 'puppeteer'
70
+ require 'puppeteer-ruby'
73
71
 
74
72
  Puppeteer.launch do |browser|
75
- page = browser.pages.last || browser.new_page
73
+ page = browser.new_page
76
74
  page.goto 'https://github.com/YusukeIwaki'
77
75
 
78
76
  # Get the "viewport" of the page, as reported by the page.
@@ -158,6 +156,75 @@ RSpec.describe 'hotel.testplanisphere.dev', type: :feature do
158
156
 
159
157
  The detailed step of configuration can be found [here](https://github.com/YusukeIwaki/puppeteer-ruby-example/tree/master/_with_capybara-rspec).
160
158
 
159
+ ## :bulb: Use Puppeteer methods simply without Capybara::DSL
160
+
161
+ We can also use puppeteer-ruby as it is without Capybara DSL. When you want to just test a Rails application simply with Puppeteer, refer this section.
162
+
163
+ Also, if you have trouble with handling flaky/unstable testcases in existing feature/system specs, consider replacing Capybara::DSL with raw puppeteer-ruby codes like `page.wait_for_selector(...)` or `page.wait_for_navigation { ... }`.
164
+
165
+ Capybara prepares test server even when Capybara DSL is not used.
166
+
167
+ Sample configuration is shown below. You can use it by putting the file at `spec/support/puppeteer_ruby.rb` or another location where RSpec loads on initialization.
168
+
169
+ ```ruby
170
+ RSpec.configure do |config|
171
+ require 'capybara'
172
+
173
+ # This driver only requests Capybara to launch test server.
174
+ # Remark that no Capybara::DSL is available with this driver.
175
+ class CapybaraNullDriver < Capybara::Driver::Base
176
+ def needs_server?
177
+ true
178
+ end
179
+ end
180
+
181
+ Capybara.register_driver(:null) { CapybaraNullDriver.new }
182
+
183
+ config.around(driver: :null) do |example|
184
+ Capybara.current_driver = :null
185
+
186
+ # Rails server is launched here,
187
+ # (at the first time of accessing Capybara.current_session.server)
188
+ @base_url = Capybara.current_session.server.base_url
189
+
190
+ require 'puppeteer'
191
+ launch_options = {
192
+ # Use launch options as you like.
193
+ channel: :chrome,
194
+ headless: false,
195
+ }
196
+ Puppeteer.launch(**launch_options) do |browser|
197
+ @puppeteer_page = browser.new_page
198
+ example.run
199
+ end
200
+
201
+ Capybara.reset_sessions!
202
+ Capybara.use_default_driver
203
+ end
204
+ end
205
+ ```
206
+
207
+ Now, we can work with integration test using `Puppeteer::Page` in puppeteer-ruby.
208
+
209
+ ```ruby
210
+ RSpec.describe 'Sample integration tests', driver: :null do
211
+ let(:page) { @puppeteer_page }
212
+ let(:base_url) { @base_url }
213
+
214
+ it 'should work with Puppeteer' do
215
+ # null driver only launches server, and Capybara::DSL is unavailable.
216
+ expect { visit '/' }.to raise_error(/NotImplementedError/)
217
+
218
+ page.goto("#{base_url}/")
219
+
220
+ # Automation with Puppeteer
221
+ h1_text = page.eval_on_selector('h1', '(el) => el.textContent')
222
+ expect(h1_text).to eq('It works!')
223
+ end
224
+ end
225
+ ```
226
+
227
+
161
228
  ## API
162
229
 
163
230
  https://yusukeiwaki.github.io/puppeteer-ruby-docs/
data/docs/api_coverage.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # API coverages
2
- - Puppeteer version: v10.1.0
3
- - puppeteer-ruby version: 0.35.0
2
+ - Puppeteer version: v10.4.0
3
+ - puppeteer-ruby version: 0.37.1
4
4
 
5
5
  ## Puppeteer
6
6
 
@@ -13,7 +13,7 @@
13
13
  * ~~errors~~
14
14
  * executablePath => `#executable_path`
15
15
  * launch
16
- * ~~networkConditions~~
16
+ * networkConditions => `#network_conditions`
17
17
  * product
18
18
  * ~~registerCustomQueryHandler~~
19
19
  * ~~unregisterCustomQueryHandler~~
@@ -81,17 +81,17 @@
81
81
  * createPDFStream => `#create_pdf_stream`
82
82
  * deleteCookie => `#delete_cookie`
83
83
  * emulate
84
- * ~~emulateCPUThrottling~~
84
+ * emulateCPUThrottling => `#emulate_cpu_throttling`
85
85
  * emulateIdleState => `#emulate_idle_state`
86
86
  * emulateMediaFeatures => `#emulate_media_features`
87
87
  * emulateMediaType => `#emulate_media_type`
88
- * ~~emulateNetworkConditions~~
88
+ * emulateNetworkConditions => `#emulate_network_conditions`
89
89
  * emulateTimezone => `#emulate_timezone`
90
90
  * emulateVisionDeficiency => `#emulate_vision_deficiency`
91
91
  * evaluate
92
92
  * evaluateHandle => `#evaluate_handle`
93
93
  * evaluateOnNewDocument => `#evaluate_on_new_document`
94
- * ~~exposeFunction~~
94
+ * exposeFunction => `#expose_function`
95
95
  * focus
96
96
  * frames
97
97
  * goBack => `#go_back`
@@ -99,11 +99,11 @@
99
99
  * goto
100
100
  * hover
101
101
  * isClosed => `#closed?`
102
- * ~~isDragInterceptionEnabled~~
102
+ * isDragInterceptionEnabled => `#drag_interception_enabled?`
103
103
  * isJavaScriptEnabled => `#javascript_enabled?`
104
104
  * keyboard
105
105
  * mainFrame => `#main_frame`
106
- * ~~metrics~~
106
+ * metrics
107
107
  * mouse
108
108
  * pdf
109
109
  * queryObjects => `#query_objects`
@@ -136,6 +136,7 @@
136
136
  * waitForFileChooser => `#wait_for_file_chooser`
137
137
  * waitForFunction => `#wait_for_function`
138
138
  * waitForNavigation => `#wait_for_navigation`
139
+ * ~~waitForNetworkIdle~~
139
140
  * waitForRequest => `#wait_for_request`
140
141
  * waitForResponse => `#wait_for_response`
141
142
  * waitForSelector => `#wait_for_selector`
@@ -166,11 +167,11 @@
166
167
 
167
168
  * click
168
169
  * down
169
- * ~~drag~~
170
- * ~~dragAndDrop~~
171
- * ~~dragEnter~~
172
- * ~~dragOver~~
173
- * ~~drop~~
170
+ * drag
171
+ * dragAndDrop => `#drag_and_drop`
172
+ * dragEnter => `#drag_enter`
173
+ * dragOver => `#drag_over`
174
+ * drop
174
175
  * move
175
176
  * up
176
177
  * wheel
@@ -272,11 +273,11 @@
272
273
  * clickablePoint => `#clickable_point`
273
274
  * contentFrame => `#content_frame`
274
275
  * dispose
275
- * ~~drag~~
276
- * ~~dragAndDrop~~
277
- * ~~dragEnter~~
278
- * ~~dragOver~~
279
- * ~~drop~~
276
+ * drag
277
+ * dragAndDrop => `#drag_and_drop`
278
+ * dragEnter => `#drag_enter`
279
+ * dragOver => `#drag_over`
280
+ * drop
280
281
  * evaluate
281
282
  * evaluateHandle => `#evaluate_handle`
282
283
  * executionContext => `#execution_context`
@@ -297,8 +298,12 @@
297
298
  ## ~~HTTPRequest~~
298
299
 
299
300
  * ~~abort~~
301
+ * ~~abortErrorReason~~
300
302
  * ~~continue~~
303
+ * ~~continueRequestOverrides~~
304
+ * ~~enqueueInterceptAction~~
301
305
  * ~~failure~~
306
+ * ~~finalizeInterceptions~~
302
307
  * ~~frame~~
303
308
  * ~~headers~~
304
309
  * ~~isNavigationRequest~~
@@ -308,6 +313,7 @@
308
313
  * ~~resourceType~~
309
314
  * ~~respond~~
310
315
  * ~~response~~
316
+ * ~~responseForRequest~~
311
317
  * ~~url~~
312
318
 
313
319
  ## ~~HTTPResponse~~
@@ -223,7 +223,7 @@ class Puppeteer::Browser
223
223
  # @param predicate [Proc(Puppeteer::Target -> Boolean)]
224
224
  # @return [Puppeteer::Target]
225
225
  def wait_for_target(predicate:, timeout: nil)
226
- timeout_in_sec = (timeout || 30000).to_i / 1000.0
226
+ timeout_helper = Puppeteer::TimeoutHelper.new('target', timeout_ms: timeout, default_timeout_ms: 30000)
227
227
  existing_target = targets.find { |target| predicate.call(target) }
228
228
  return existing_target if existing_target
229
229
 
@@ -241,15 +241,9 @@ class Puppeteer::Browser
241
241
  end
242
242
 
243
243
  begin
244
- if timeout_in_sec > 0
245
- Timeout.timeout(timeout_in_sec) do
246
- target_promise.value!
247
- end
248
- else
244
+ timeout_helper.with_timeout do
249
245
  target_promise.value!
250
246
  end
251
- rescue Timeout::Error
252
- raise Puppeteer::TimeoutError.new("waiting for target failed: timeout #{timeout}ms exceeded")
253
247
  ensure
254
248
  remove_event_listener(*event_listening_ids)
255
249
  end
@@ -74,6 +74,7 @@ class Puppeteer::BrowserContext
74
74
  'clipboard-read' => 'clipboardReadWrite',
75
75
  'clipboard-write' => 'clipboardReadWrite',
76
76
  'payment-handler' => 'paymentHandler',
77
+ 'persistent-storage' => 'durableStorage',
77
78
  'idle-detection' => 'idleDetection',
78
79
  # chrome-specific permissions we have.
79
80
  'midi-sysex' => 'midiSysex',
@@ -94,7 +94,7 @@ class Puppeteer::BrowserRunner
94
94
  FileUtils.rm_rf(@temp_directory)
95
95
  end
96
96
  }
97
- trap(:EXIT) do
97
+ at_exit do
98
98
  kill
99
99
  end
100
100
 
@@ -3,11 +3,11 @@ module Puppeteer::ConcurrentRubyUtils
3
3
  module ConcurrentPromisesFutureExtension
4
4
  # Extension for describing 2 concurrent tasks smartly.
5
5
  #
6
- # page.async_for_navigation.with_waiting_for_complete do
6
+ # page.async_wait_for_navigation.with_waiting_for_complete do
7
7
  # page.click('#submit')
8
8
  # end
9
9
  def with_waiting_for_complete(&block)
10
- async_block_call = Concurrent::Promises.future do
10
+ async_block_call = Concurrent::Promises.delay do
11
11
  block.call
12
12
  rescue => err
13
13
  Logger.new($stderr).warn(err)
@@ -5,10 +5,14 @@ class Puppeteer::Coverage
5
5
  @css = Puppeteer::CSSCoverage.new(client)
6
6
  end
7
7
 
8
- def start_js_coverage(reset_on_navigation: nil, report_anonymous_scripts: nil)
8
+ def start_js_coverage(
9
+ reset_on_navigation: nil,
10
+ report_anonymous_scripts: nil,
11
+ include_raw_script_coverage: nil)
9
12
  @js.start(
10
13
  reset_on_navigation: reset_on_navigation,
11
14
  report_anonymous_scripts: report_anonymous_scripts,
15
+ include_raw_script_coverage: include_raw_script_coverage,
12
16
  )
13
17
  end
14
18
 
@@ -16,7 +20,11 @@ class Puppeteer::Coverage
16
20
  @js.stop
17
21
  end
18
22
 
19
- def js_coverage(reset_on_navigation: nil, report_anonymous_scripts: nil, &block)
23
+ def js_coverage(
24
+ reset_on_navigation: nil,
25
+ report_anonymous_scripts: nil,
26
+ include_raw_script_coverage: nil,
27
+ &block)
20
28
  unless block
21
29
  raise ArgumentError.new('Block must be given')
22
30
  end
@@ -24,6 +32,7 @@ class Puppeteer::Coverage
24
32
  start_js_coverage(
25
33
  reset_on_navigation: reset_on_navigation,
26
34
  report_anonymous_scripts: report_anonymous_scripts,
35
+ include_raw_script_coverage: include_raw_script_coverage,
27
36
  )
28
37
  block.call
29
38
  stop_js_coverage
@@ -40,7 +40,7 @@ module Puppeteer::DefineAsyncMethod
40
40
  end
41
41
  end
42
42
 
43
- async_block_call = Concurrent::Promises.future do
43
+ async_block_call = Concurrent::Promises.delay do
44
44
  block.call
45
45
  rescue => err
46
46
  Logger.new($stderr).warn(err)