c# - How to save dynamic image in WatIn -


this question has answer here:

i trying save image changes dynamically each request.

i tried watin , httpwebrequest (getting new image)

httpwebrequest request = (httpwebrequest)webrequest.create("www.test.com"); request.allowautoredirect = false; webresponse response = request.getresponse();  using (stream stream = response.getresponsestream()) using (filestream fs = file.openwrite(imagecodepath)) {     byte[] bytes = new byte[1024];     int count;      while ((count = stream.read(bytes, 0, bytes.length)) != 0)     {         fs.write(bytes, 0, count);     } } 

and (user32.dll) urldownloadtofile (getting new image)

[dllimport("urlmon.dll", charset = charset.auto, setlasterror = true)] static extern int32 urldownloadtofile(int32 pcaller, string szurl, string szfilename, int32 dwreserved, int32 lpfncb);  urldownloadtofile(0, "https://test.reporterimages.php?main_theme=1", imagecodepath, 0, 0); 

i looked in temp folders , still can't find image.

path.combine(environment.getfolderpath(environment.specialfolder.internetcache),"content.ie5"); 

every time try save server builds new image , returns it. if right click on image , choose:

save picture as...

it save picture. need somehow implement method (right-click, save picture as...) in watin in ie, or somehow download httprequest html page without server interaction.

does know how can this?

as understand, idea capture current captcha image on page in browser bypass text recognition (btw, strange idea). , no problem image url (it same). in case can use api access browser cache. ie findfirsturlcacheentry/findnexturlcacheentry can if application hosts webbrowser.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -