Task is not completing second time [Intermittent Issue] – Async/ Await

前端 未结 1 1535
予麋鹿
予麋鹿 2021-01-23 05:48

I have a WebBrowser control is Windows Forms project. It navigates through all the urls available in “MyTableTest.html”. There are four urls in this page and the

相关标签:
1条回答
  • 2021-01-23 05:53

    "Location 1" is printed but not "Location 2". What is your suggestion to overcome this? Were you able to reproduce this issue?

    I haven't tried to repro, but like I said in the comment, it's obvious that either DocumentCompleted or window.onload is not getting fired for that particular URL. That's possible if the page cannot be fully loaded, or e.g. if the URL is invalid or the server becomes unreachable. That's what the time-out logic is for.

    Put one more trace at the beginning of documentCompletedHandler, and one more inside onloadEventHandler:

    onloadEventHandler = (s, e) => { Log("inside onloadEventHandler");
        onloadTcs.TrySetResult(true); }
    

    See what gets fired and what doesn't.

    Besides, your should also implement WebBrowser Feature Control to enable the modern IE features. This also often affects how web page are loaded. Copy SetFeatureBrowserEmulation from here.

    0 讨论(0)
提交回复
热议问题