WebBrowsing in C# - Libraries, Tools etc. - Anything like Mechanize in Perl? [closed]

有些话、适合烂在心里 提交于 2019-11-28 19:11:15

问题


Looking for something similar to Mechanize for .NET...

If you don't know what Mechanize is.. http://search.cpan.org/dist/WWW-Mechanize/

I will maintain a list of suggestions here. Anything for browsing/posting/screen scraping (Other than WebRequest and WebBrowser Control).

Parsing

  • HTMLAgilityPack - http://www.codeplex.com/htmlagilitypack

Web App Testing

  • WatiN - Web Application Testing Framework (.NET) - http://watin.sourceforge.net/

  • Selenium - http://seleniumhq.org/

  • Art of Test Design Canvas - Costs Money

Tools

  • Firebug for Firefox
  • Internet Explorer Developer Toolbar for IE
  • Chrome has one too

Note

WatiN is close to what I am looking for, except it opens up a browser, which is annoying and awesome at the same time. Depends on what you are doing.


回答1:


I've been using WatiN to great effect. It's an easy way to 1) automate user input w/ IE and 2) navigate the DOM.




回答2:


You can use the WebBrowser control, which can be automated to an extent.




回答3:


You need to use the HTML Agility Pack, which can parse tag soup from real websites into a DOM structure.




回答4:


You can also use Selenium. It's for unit testing web sites. It has a java application that drives the browser and a C# interface that you can write your code in. It also has the downside of showing the browser, but it's pretty full featured in terms of control, waiting on responses and getting the results.




回答5:


Design Canvas is the best tool out there for this type of thing. Works with IE, Firefox, Safari, or an in-memory browser. It allows you to record and then playback any kind of web interaction.




回答6:


You want HttpWebRequest for automating web requests and HtmlAgilityPack for processing the resulting HTML.




回答7:


I have reverse engineered Python-Mechanize, and recreated it in C#, called Mechanize.NET.

https://github.com/WilliamABradley/Mechanize.NET

This should hopefully cover all use cases of Mechanize, if not, or you discover a bug, create an issue.

It uses .NET Standard, so it should be usable across .NET, such as with F#, VB, etc.

It utilises HtmlAgilityPack internally, and you can even collect the HtmlDocument for each loaded page.



来源:https://stackoverflow.com/questions/2149867/webbrowsing-in-c-sharp-libraries-tools-etc-anything-like-mechanize-in-perl

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