I need to save the content of an image from a URL based on a PHP file using selenium. I am able to do this using requests by saving the pages .content then writing it to a new jpeg file, here is that code:
import time
import requests
cropped = './images/sample.jpeg'
response = requests.get(url)
time.sleep(2)
if response.status_code == 200:
with open(cropped, 'wb') as f:
f.write(response.content)
How am I able to replicate .content using selenium? I need to access the page's body as bytes, for non-text requests (as it is an image). I have tried .page_source for selenium to no extent on my end.