开发者

Interact with a JavaScript page in C#

开发者 https://www.devze.com 2023-03-09 00:39 出处:网络
This is an example page: http://scores.covers.com/basketball-scores-matchups.aspx?t=0 Let\'s say that I want to download the pages that are behind the \"Boxscore\" link f开发者_开发技巧or a range of

This is an example page:

http://scores.covers.com/basketball-scores-matchups.aspx?t=0

Let's say that I want to download the pages that are behind the "Boxscore" link f开发者_开发技巧or a range of dates. The date is changed using JavaScript. How do I do emulate clicking on next and previous dates and get the contents of the refreshed boxscore link?


You essentially want to do screen scraping. You want to access the output of a web page through C#. There are many libraries that allow you to do this. The best other use case for the tool you want is writing User interface tests, and many UI test frameworks support it.

Take a look at WatiN, for example. You can use it to "emulate" user behavior on a web page. Another candidate would be Telerik's testing framework (disclaimer: I work for Telerik)


In the handler response, you are getting boxscore link in gamehtml. In handler code, you can extract the link using regular expression and download it using httpwebrequest.

OR

try HTMLAgilityPack

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号