0


Thumbs Up |
Received: 3 Given: 1 |
need to mothode for download capctcha to disk
i tested
this is not good for me beacuse captcha in my page , changes place every refresh :/Code:Bitmap bmp = new Bitmap(WindowsImageCreator.GetBitmap(geckoWebBrowser1, 400, 850, 400, 150)); bmp.Save(Application.StartupPath + "\\img1.gif", ImageFormat.Gif);
if u know how to fix pls help me ...thx...
Code:<div id="adcopy-puzzle-image" style="height: 150px; width: 300px; text-align: left;"> <embed id="adcopy-puzzle-image-image" flashvars="url=https://freebitco.in/?op=home&clickTAG=https://api-secure.solvemedia.com/papi/action?c=2@Tw5szIz9haroDwT2alQdXZvD-dgNdDOh@UdmsANdYWdwENU8bgrSwNX9APTC4lJjoHezCUD.IVKVWNpkeY.bfdJ1Py2OznLAX6AroHrvqN3uYJtp6hjetFalkP83WGnhCgiqQo.2qR-J6Q5mFIvhutJ6yPcnS3W1VwLYZJf5l0w7HnxCdW30iGyVC-SNynyUqnMV1Hvlrqvnpb-fYVg3KjvmGk.2MyokUozKxuza2RrcwMjKdLy2t5Bw6yMjCK.Vf02cZp7qX6Lw6PkrjnBGAllOpbTaj6QbvxGkq3kPX.UPfQUAcc2Ft7YE4ZwbNAiQoJkhFXIK0uoA&listener=adcopy_media_listener" allowscriptaccess="always" wmode="opaque" style="width:100%;height:100%;padding:0;margin:0;" src="https://api-secure.solvemedia.com/acmedia/f/0/f0I51krdedeMNi/Q/Qkyq.r8drdedfsNs.swf" type="application/x-shockwave-flash"> </div>
Thumbs Up |
Received: 44 Given: 50 |
This way you should get your image in 'ourimg' var. You can directly load it into picture box or save into disk.Code:foreach (GeckoHtmlElement imgelement in geckoWebBrowser1.Document.GetElementsByTagName("div")) { if (imgelement.GetAttribute("id")=="adcopy-puzzle-image") { GeckoImageElement ourimgage = (GeckoImageElement)imgelement; Image ourimg = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(new System.IO.MemoryStream(Gecko.Utils.SaveImageElement.ConvertGeckoImageElementToPng(geckoWebBrowser1, ourimgage, 0, 0, ourimgage.OffsetWidth, ourimgage.OffsetHeight))); } }
Thumbs Up |
Received: 115 Given: 12 |
Has this been fixed?
I will be more than happy to close this thread on your command.
Still M̶o̶d̶e̶r̶a̶t̶i̶n̶g̶...
.//ban @user"Stay Low, go fast. Kill first, Die last. One shot, One kill. No luck, all Skill."
Thumbs Up |
Received: 3 Given: 1 |
I found this ... working good
or easier methodepublic void getsolvemedia(int a, int b)
{
Bitmap bmp = new Bitmap(CreateImage(wb));
Rectangle cropRect = new Rectangle(a, b, 307, 157);
bmp.Save("full.png");
bmp = bmp.Clone(cropRect, bmp.PixelFormat);
Image img = bmp;
img = resizeImage(img, new Size(153, 79));
img.Save("captcha.png");
picture.Image = img;
GeckoInputElement answer = new GeckoInputElement(wb.Document.GetElementsByName("a dcopy_response")[0].DomObject);
answer.Value = captcha;
if (captcha.Length >= 2)
{
GeckoButtonElement sub = new GeckoButtonElement(wb.Document.GetElementsByClassN ame("btn btn-warning")[0].DomObject);
sub.Click();
}
}
public static Image resizeImage(Image imgToResize, Size size)
{
return new Bitmap(imgToResize, size);
}
private Image CreateImage(GeckoWebBrowser browser)
{
var w = wb.Document.ActiveElement.ScrollWidth;
var h = wb.Document.ActiveElement.ScrollHeight;
var creator = new ImageCreator(browser);
byte[] imageBytes = creator.CanvasGetPngImage((uint)w, (uint)h);
using (var stream = new MemoryStream(imageBytes))
{
return Image.FromStream(stream);
}
}
public Point GetOffset2(GeckoHtmlElement el)
{
Point pos = new Point(el.OffsetLeft, el.OffsetTop);
GeckoHtmlElement tempEl = el.OffsetParent;
while (tempEl != null)
{
pos.X += tempEl.OffsetLeft;
pos.Y += tempEl.OffsetTop;
tempEl = tempEl.OffsetParent;
}
return pos;
}
var point = GetOffset2(wb.Document.GetHtmlElementById("adcopy-outer"));
var x = point.X;
var y = point.Y;
getsolvemedia(x, y);
Yest ...Solved ....Pls close.... thx for allusing Gecko.Utils;
Point GetScreenCordinates(GeckoHtmlElement obj)
{
Point p = new Point();
try
{
p.X = obj.OffsetLeft;
p.Y = obj.OffsetTop;
GeckoHtmlElement _Parent = obj;
while ((_Parent = _Parent.OffsetParent) != null)
{
p.X += _Parent.OffsetLeft;
p.Y += _Parent.OffsetTop;
}
}
catch { }
return p;
}
private Bitmap GetElementAsImage(GeckoHtmlElement input)
{
Point cords = GetScreenCordinates(input);
return ActiveBrowser.GetBitmap((uint)cords.X, (uint)cords.Y, (uint)input.ClientWidth, (uint)input.ClientHeight);
}
GetElementAsImage((GeckoHtmlElement)ActiveBrowser. Document.GetElementById("adcopy-outer"));
Last edited by martin0409; 09-14-2015 at 12:53 PM.
Thumbs Up |
Received: 44 Given: 50 |
Bookmarks