I am doing some automation on the sever side. I’d like to somehow interact with the HTML page through Python code and access the pixel data. What kind of options Selenium offers for his kind of approaches?
Possible considerations
-
Raw pixel data access in in-process memory
-
Get pixels by saving them to a local image file (PNG)
-
Get pixels by saving them to a memory, listening port on localhost and pushing the data there over AJAX
-
Creating an image file and accessing it directly in-process memory
Using Selenium you can query the canvas for its image data using Selenium’s
getEvalmethod (ref) with some smartly designed js code.You can do it pixel by pixel if that’s what you want, or just grab the entire canvas using the
toDataURLmethod.