← Back to Discord Forum

how to get body from response in playwright

hi , i am trying to send request for api and getting its body from the response. what is the best way to do that? i am getting the body in buffer - and i dont succeed to turn this to string.

This thread is trying to answer question "What is the best way to get the body from the response of an API request in playwright?"

3 replies

maybe this will help you:


Hi, if you want the parsed Json response for a REST API call, you can use https://playwright.dev/docs/api/class-response#response-json

(It's not returning a string, not a buffer, but a parsed (deserialized) object, which in most cases is the most convenient.)

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.