scraping/simulate browsing help

百般思念 提交于 2019-12-23 03:21:35

问题


I want to make a program that will simulate a user browsing a site and clicking on links. Cookies and javascript have to be enabled. I've successfully done this in python, but I want to write it an compilable language (python ide's don't cut it). The links on the site are generated with javascript and are dynamic. With python I used PAMIE (third party module that uses win32com) to launch an instance of Internet explorer, scrape the generated html for the links, then navigate to one of them. The point is for the whole process to be transparent to the server. What's the best (compilable) language and method to do this? I was thinking C# with WebBrowser control but I don't want to spend a lot of time learning something if it isn't going to work. Any kind help is appreciated!


回答1:


You might want to look at the automated testing via browser suites: http://www.teknologika.com/blog/the-holy-grail-net-automated-web-gui-testing-for-internet-explorer/ http://watin.sourceforge.net/




回答2:


I wrote a blog post on this awhile back: Web scraping in .NET. That discusses cookies but not JavaScript; I don't know if that would require additional coding.




回答3:


Might be worth having a look at selenium .

We use it for web testing in a C# asp.net envirnorment.

The documentation isn't to bad



来源:https://stackoverflow.com/questions/1419357/scraping-simulate-browsing-help

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