Using CasperJs, I'm trying to do some testing on canvas, by grabbing it and using canvas.toDataURL();
. However, the canvas does not have an id, the code looks something like this:
<div id= 'derp' ...>
<canvas ...> </canvas>
</div>
Can I still get the canvas using something like
var canvas = document.getElementById(????);
or is there a better way of grabbing the canvas?
You can use CSS selectors:
document.querySelector('#derp canvas')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With