C# library similar to HtmlUnit

試著忘記壹切 提交于 2019-12-19 04:24:30

问题


I need to write standalone application which will "browse" external resource. Is there lib in C# which automatically handles cookies and supports JavaScript (through JS is not required I believe)? The main goal is to keep session alive and submitting forms so I could pass multistep registration process or "browse" web site after login. I reviewed Html Agility Pack but it looks like it doesn't contain functionality I need - form submitting or cookie support.

Thanks, Artem.


回答1:


Look at Data Extracting SDK, which allows to post data via HtmlProcessor class. Also you can add your work item here if it is missed in the library.




回答2:


If you're interested in writing your own version of htmlunit for C#, the IKVM project may be of help. http://www.ikvm.net/




回答3:


The HtmlAgilityPack is specifically for parsing HTML. You can use the WebRequest class in the .NET Framework to handle communication and cookies.

See my blog entry on Web scraping in .NET. This won't answer all your questions, but will get you part of the way there.




回答4:


http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx Try you WebBrowser class and work with DOM there




回答5:


Selenium, it uses the actual browsers, but is a cross browser platform. Depends on wether or not you can have an actual browser running - it works by injecting javascript via a proxy into the browser. http://seleniumhq.org/support/



来源:https://stackoverflow.com/questions/1512632/c-sharp-library-similar-to-htmlunit

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