I want to fetch a response body as string in selenium-wire which I will eventually parse as JSON.
response.body
in selenium-wire gives bytes string. I tried decoding it as response.body.decode('utf-8')
but this gives decoding error.
Can someone help me with this? I am fine with both solutions:
- Either a way to decode the bytes string as normal string
- A way to get response body as normal string in the first place
I figured out a way to do this (not an ideal approach) While making the selenium webdriver object, you can pass a parameter
options
in which you can tell it explicitly to give decoded request and response objects and not as bytes.