arnoudbuzing / webtools

A Wolfram Language package which automates interactions with web browsers
Other
33 stars 6 forks source link

Download Image using WebUnit #7

Closed wjxway closed 6 years ago

wjxway commented 6 years ago

Is it possible for WebUnit to download images on the page? Note that Fetching URL is not always an option, as sometimes image differs between calls even if the URLs are the same(E.G. verification code images).

arnoudbuzing commented 6 years ago

Have you tried something like this:

JavascriptExecute["
 images=document.images;
 var href = [];
 for(i=0;i<images.length;i++) {href[i]=images[i].src;}
 return href;
 "]

And then you can import those urls in the Wolfram Language.

wjxway commented 6 years ago

I've tried this, the general idea of this method is fetching URL and send another request to this URL, expecting to get an identical image. But sometimes the content inside the URL is time varying, so sending another request is not always an option... Are there any way without involving another request?

arnoudbuzing commented 6 years ago

Not that I can think of.