toDataURL not a function
getElementsByTagName
returns a NodeList
[docs], not a single element.
Simply access the first element of the list:
var src = can[0].toDataURL("image/png");
If you want to get the data URL for each canvas, then you have to iterate over the list. Otherwise, giving the canvas an ID and retrieving the reference with getElementById
might be more convenient.
Double check you are running toDataURL()
the canvas object itself, not on the context object.