今天在用python调用IE获取html网页元素在屏幕上的坐标,当然为了截图啦,(*^__^*) 嘻嘻……
xtop=ie.document.forms[i].elements[j].getBoundingClientRect().top + ie.document.parentwindow.screentop
xleft=ie.document.forms[i].elements[j].getBoundingClientRect().left + ie.document.parentwindow.screenleft
xwidth= ie.document.forms[i].elements[j].getBoundingClientRect().right - ie.document.forms[i].elements[j].getBoundingClientRect().left
xheight= ie.document.forms[i].elements[j].getBoundingClientRect().bottom - ie.document.forms[i].elements[j].getBoundingClientRect().top
forms[i].elements[j].可以用 getElementById(“username”) 代替
然后用python调用delphi截图程序,这样就可以获取网页元素上的截图了,有什么用,嘻嘻,获取图形验证码嘛,然后…
delphi的截图函数:
procedure tform1.snapscreen(a,b,c,d:Integer);
var
bmpscreen:Tbitmap;
jpegscreen:Tjpegimage;
FullscreenCanvas:TCanvas;