|
61 | 61 | `Cuprite`-specific options are: |
62 | 62 |
|
63 | 63 | * options `Hash` |
64 | | - * `:url_blacklist` (Array) - array of strings to match against requested URLs |
65 | | - * `:url_whitelist` (Array) - array of strings to match against requested URLs |
| 64 | + * `:url_blacklist` (Array) - array of regexes to match against requested URLs |
| 65 | + * `:url_whitelist` (Array) - array of regexes to match against requested URLs |
66 | 66 |
|
67 | 67 |
|
68 | 68 | ## Debugging |
@@ -122,13 +122,17 @@ be automatically cleared at the end of the test. |
122 | 122 |
|
123 | 123 | ## Network traffic |
124 | 124 |
|
125 | | -* `page.driver.network_traffic` Inspect network traffic (loaded resources) on |
126 | | -the current page. This returns an array of request objects. |
| 125 | +* `page.driver.network_traffic` allows you to inspect network traffic (i.e., loaded resources) on the current page. It returns an array of `Ferrum::Network::Exchange` objects, each representing a network request/response exchange. You can query both the request and response details of each exchange. |
127 | 126 |
|
128 | 127 | ```ruby |
129 | | -page.driver.network_traffic # => [Request, ...] |
130 | | -request = page.driver.network_traffic.first |
131 | | -request.response |
| 128 | +# Retrieve all network exchanges |
| 129 | +network_traffic = page.driver.network_traffic |
| 130 | + |
| 131 | +# Access the first exchange |
| 132 | +first_exchange = network_traffic.first |
| 133 | + |
| 134 | +# Inspect the response of the first request |
| 135 | +response = first_exchange.response |
132 | 136 | ``` |
133 | 137 |
|
134 | 138 | * `page.driver.wait_for_network_idle` Natively waits for network idle and if |
@@ -183,27 +187,29 @@ Besides capybara screenshot method you can get image as Base64: |
183 | 187 |
|
184 | 188 | ## Proxy |
185 | 189 |
|
186 | | -* `page.driver.set_proxy(ip, port, type, user, password)` |
| 190 | +* `page.driver.set_proxy(ip, port, user, password)` |
187 | 191 |
|
188 | 192 |
|
189 | | -## URL Blacklisting & Whitelisting |
| 193 | +## URL Blocklisting & Allowlisting |
190 | 194 |
|
191 | | -Cuprite supports URL blacklisting, which allows you to prevent scripts from |
| 195 | +Cuprite supports URL blocklisting, which allows you to prevent scripts from |
192 | 196 | running on designated domains: |
193 | 197 |
|
194 | 198 | ```ruby |
195 | | -page.driver.browser.url_blacklist = %r{http://www.example.com} |
| 199 | +page.driver.browser.url_blocklist = %r{http://www.example.com} |
196 | 200 | ``` |
197 | 201 |
|
198 | | -and also URL whitelisting, which allows scripts to only run on designated |
| 202 | +and also URL allowlisting, which allows scripts to only run on designated |
199 | 203 | domains: |
200 | 204 |
|
201 | 205 | ```ruby |
202 | | -page.driver.browser.url_whitelist = %r{http://www.example.com} |
| 206 | +page.driver.browser.url_allowlist = %r{http://www.example.com} |
203 | 207 | ``` |
204 | 208 |
|
205 | | -If you are experiencing slower run times, consider creating a URL whitelist of |
206 | | -domains that are essential or a blacklist of domains that are not essential, |
| 209 | +For legacy support, `url_blacklist=` and `url_whitelist=` continue to work respectively. |
| 210 | + |
| 211 | +If you are experiencing slower run times, consider creating a URL allowlist of |
| 212 | +domains that are essential or a blocklist of domains that are not essential, |
207 | 213 | such as ad networks or analytics, to your testing environment. |
208 | 214 |
|
209 | 215 | ## License |
|
0 commit comments