如何从gecko Web浏览器获取源HTML? InnerHtml不再存在

时间:2013-12-12 15:24:30

标签: c# gecko geckofx

GeckoFx v22

GeckoElement element = null;
var geckoDomElement = WebBrowser1.Document.DocumentElement;
if(geckoDomElement  is GeckoElement)
  element = (GeckoElement)geckoDomElement ;

var innerHtml = element.InnerHtml;

但不再有InnerHtml方法。如何从gecko Web浏览器获取源HTML?

1 个答案:

答案 0 :(得分:3)

转换为GeckoHtmlElement而不是GeckoElement。

GeckoHtmlElement element = null;
var geckoDomElement = WebBrowser1.Document.DocumentElement;
if(geckoDomElement is GeckoHtmlElement)
{
  element = (GeckoHtmlElement)geckoDomElement;    
  var innerHtml = element.InnerHtml;
}