Skip to content

Commit 796d03a

Browse files
authored
Update README.md on network traffic method (#275)
1 parent 503179f commit 796d03a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,17 @@ be automatically cleared at the end of the test.
122122

123123
## Network traffic
124124

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.
127126

128127
```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
132136
```
133137

134138
* `page.driver.wait_for_network_idle` Natively waits for network idle and if

0 commit comments

Comments
 (0)