M
M
maryaturova2021-10-29 21:30:43
Python
maryaturova, 2021-10-29 21:30:43

Selenium+Python. How to get an image without saving to disk?

Dear! Is there a way to get the image without saving it to disk?
I did not find an answer on the Internet.
This code saves via screenshot:

driver.find_element_by_css_selector('.class_name').screenshot('image.png')

But I would like to be able to get a picture in bytes without saving.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2021-10-29
@maryaturova

Something like this:

screenshot = driver.find_element_by_css_selector('class_name').screenshot_as_png

617c4d30687e3620291404.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question