Closed
Description
I am trying to retrieve and decode the response body of requests using SeleniumBase. Below is the code I am using:
from seleniumbase import Driver
driver = Driver(wire=True)
driver.get("https://seleniumbase.io/demo_page")
for request in driver.requests:
body_bytes = request.response.body
str_body = body_bytes.decode("utf-8")
print(request.url)
print(str_body)
driver.quit()
Problem:
- I want to extract the response body in a readable JSON or string format.
- The above implementation retrieves the body but may not be in a structured format.
Expected Behavior:
- The response body should be in a structured JSON or string format for easy processing.
How can I properly decode and parse the response body in JSON or as a readable string?
Thank you for your support!!