How to navigate in a list of links using webbrowser?

眉间皱痕 提交于 2019-12-01 05:57:55
noseratio

To implement this, async/await and Task Parallel Library may come in handy. They allow to have familiar, pseudo-linear code flow for what is an asynchronous logic (handling DocumentCompleted events for multiple navigations, one after another).

I answered a similar question for a WinForm app here and for a console app here.

If you need to target .NET 4.0 but develop with VS2012+ , you still can use async/await, Microsoft provides the Microsoft.Bcl.Async library for that.

If C# 5.0 is not available for this project, you can use yield, as described here.

If a page has scripts errors on it, it is possible it will never complete. You should make a timeout for that event.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!