Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83348

Grabbing <canvas> pixels through Selenium / Python

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

Upvotes: 5

Views: 2277

Answers (1)

Variant
Variant

Reputation: 17365

Using Selenium you can query the canvas for its image data using Selenium's getEval method (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 toDataURL method.

Upvotes: 2

Related Questions