CefSharp - Get Value of HTML Element

后端 未结 5 1348
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-12 10:20

How can I get the value of an HTML element with CefSharp?

I know how to do with this default WebBrowser Control:

Dim Elem As HtmlElement = WebBrowser         


        
5条回答
  •  误落风尘
    2021-01-12 10:40

    this is the only way that worked for me, version 57.0.0.0..

    ((CefSharp.Wpf.ChromiumWebBrowser)chromeBrowser).FrameLoadEnd += Browser_FrameLoadEnd;
    

    ....

    async void Browser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
        {            
            Console.WriteLine("cef-"+e.Url);
    
            if (e.Frame.IsMain)
            {                 
                string HTML = await e.Frame.GetSourceAsync();               
                Console.WriteLine(HTML);
            }
        }
    

提交回复
热议问题