【问题标题】:Loading URL Synchronously not working correctly同步加载 URL 无法正常工作
【发布时间】:2018-07-23 06:22:47
【问题描述】:

如何设置Wait超时?我有呈现 dom 的页面,并且下一页发送几个 ajax 请求。 Dotnetbrowser 认为该页面已完成加载,但网络请求仍在增加。

BrowserView browser= new WinFormsBrowserView(BrowserFactory.Create());    
ManualResetEvent waitEvent = new ManualResetEvent(false);
browser.FinishLoadingFrameEvent += delegate(object sender, FinishLoadingEventArgs e)
{
    // Wait until main document of the web page is loaded completely.
    if (e.IsMainFrame)
    {
        waitEvent.Set();
    }
};
browser.LoadURL("http://www.example.com");
waitEvent.WaitOne();

【问题讨论】:

    标签: c# dotnetbrowser


    【解决方案1】:

    ManualResetEvent.WaitOne 方法具有以毫秒为单位的时间间隔的重载。您可以使用它来指定超时时间。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-11-08
      • 1970-01-01
      • 1970-01-01
      • 2018-06-15
      • 2020-09-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多