From 796d03a2c91b38172aa2ca80ef510c4ccbc29de0 Mon Sep 17 00:00:00 2001 From: Yann Petitjean Date: Mon, 25 Nov 2024 15:51:00 +0900 Subject: [PATCH] Update README.md on network traffic method (#275) --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cad072a..5e48e49 100644 --- a/README.md +++ b/README.md @@ -122,13 +122,17 @@ be automatically cleared at the end of the test. ## Network traffic -* `page.driver.network_traffic` Inspect network traffic (loaded resources) on -the current page. This returns an array of request objects. +* `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. ```ruby -page.driver.network_traffic # => [Request, ...] -request = page.driver.network_traffic.first -request.response +# Retrieve all network exchanges +network_traffic = page.driver.network_traffic + +# Access the first exchange +first_exchange = network_traffic.first + +# Inspect the response of the first request +response = first_exchange.response ``` * `page.driver.wait_for_network_idle` Natively waits for network idle and if