Posts

Showing posts from May, 2013

Donate

GeckoFX How To Trigger Or Fire JavaScript _doPostBack() Method

Here's how you fire a _doPostBack() in ASP.NET using GeckoFX. //fire js method using (AutoJSContext context = new AutoJSContext( this .JSContext)) { string result; context.EvaluateScript( string .Format( "javascript:__doPostBack('{0}','')" , paramControlName), out result); } Cheers!

GeckoFX DocumentText Similar To Webbrowser Control (C#)

In a traditional webbrowser control, you can get the page source like this: string pageSource = webbrowser1.DocumentText; However, in GeckoFX webbrowser, there's no DocumentText property. A workaround is to get the InnerHtml property of html tag using the code below: string pageSource = string .empty; if (! string .IsNullOrEmpty( this .Document.GetElementsByTagName( "html" )[0].InnerHtml)) pageSource = this .Document.GetElementsByTagName( "html" )[0].InnerHtml; Cheers!

GeckoFx getElementByID() click() Method Missing

In an application that i am creating using Gecko FX version 15, I noticed that getElementsByTagName() has an invoke member click() as shown below: this .Document.GetElementsByTagName(geckoElement.TagName)[indexSearchElement].Click(); But missing in getElementByID(). After experimenting for a few hours, I came up with the solution below: ((GeckoHtmlElement) this .Document.GetElementById(elemId)).Click(); The trick was to cast it as GeckoHtmlElement. Greg

WebClient Slow In Crawling Or Web Scraping A Website In C#

Here's a tip i got from stack overflow on webclient slow on web crawling. 1 2 3 ServicePointManager.DefaultConnectionLimit = int .MaxValue; ServicePointManager.MaxServicePoints = int .MaxValue; ServicePointManager.MaxServicePointIdleTime = 0; I simply changed the default connection limit and max service points to a numeric value. Then, the crawling starts to speed up. Greg

Donate