Posts

Showing posts with the label GeckoFX

Donate

GeckoFX DocumentText Similar To Webbrowser Control Alternative (C#)

In this post GeckoFX DocumentText similar to Webbrowser , I presented a solution on how to retrieve the page source of a website. However, another solution was provided by a .NET guru using TextContent property: this .Document.GetElementsByTagName( "html" )[0].TextContent; Cheers!

Loop Through HTML Elements Using GeckoFX WebBrowser

Hello, Below are snippets on how to loop through HTML Elements Using GeckoFX WebBrowser both in C# and VB.NET. C#: 1 2 3 4 5 //Note: this.DomDocument is a class which inherits the GeckoWebBrowser control foreach (GeckoElement element in this .DomDocument.GetElementsByTagName( "span" )) { //some codes here } VB.NET: 1 2 3 4 'Note: this.DomDocument is a class which inherits the GeckoWebBrowser control For Each element As GeckoElement In Me .DomDocument.GetElementsByTagName( "span" ) 'some codes here Next

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

Donate