Reputation: 2060
I want to be able to launch multiple browser windows and get the html from them and interact with them like I can with the .net web browser control. The problem is the c# web browser control requires STA threading and that makes my program slower and error prone. Is their a way I can talk to the real IE browser or even Chrome, Firefox etc and do this?
I know there is paid third party solutions and stuff but I was wondering if anybody knew of any free libraries that are reliable and work. I can't use HttpWebRequest for what I am doing, so don't suggest that please.
I will be running on Windows and using C#.
Upvotes: 0
Views: 3165
Reputation: 14153
I have used WebKit.NET. Its free and works great (supports flash, css, renders correctly, has a javascript engine). It may or may not be to extensive for what you are doing.
http://webkitdotnet.sourceforge.net/
There are plenty of guides, and the demo has a fully featured tab system.
EDIT: I was fooling around with it, and made an enhanced version of the demo
Upvotes: 2
Reputation: 65702
Or another webbrowser control: http://code.google.com/p/geckofx/
Embeding Firefox Brower In C# Using GeckoFX
Upvotes: 1
Reputation: 1430
For IE (only). Free: Microsoft Internet Controls
using SHDocVw;
Microsoft HTML Object Library
using mshtml;
With these you can do things like
foreach (InternetExplorer brIns in _allWindows)
{
var htmlDoc = brIns.Document as HTMLDocument;
if (htmlDoc != null && htmlDoc.all.item(elementName) != null)
{
var elem = htmlDoc.all.item(elementName) as HTMLInputElement;
if (elem != null && attributeName == null)
{
_ieCurrentDoc = htmlDoc;
_currentHtml = htmlDoc.documentElement.outerHTML;
return true;
}
if (elem != null && elem.getAttribute(attributeName) != null)
{
_ieCurrentDoc = htmlDoc;
_currentHtml = htmlDoc.documentElement.outerHTML;
return true;
}
}
}
Upvotes: 1
Reputation:
Awesomeium is a Webkit/Chromium (Chrome) based browser you can talk to via a .NET wrapper, much like the WebBrowser control. I'm not sure on the STA threading requirement though.
As for STA Threading making your application "slower and error prone" -- This sounds odd, perhaps you should investigate solving this.
Upvotes: 1