开发者

C# code to simulate clicking on links

Please take a look at this website. It allows you to change the date using either the calendar or the 'next' and 'previous' links. Whenever a date is changed, the match data below is updated. I want to programmatically select a date, then retrieve the URL behind the 'Boxscore' link in the lower part.

I have tried the WebBrowser control, which often doesn't load the page fully, and if it does, I can't find a way to interact with the controls. (I'm stuck at webBrowser.Document.GetElementById("calendar id")). I've also tried WatiN(watin.org), which causes problems with dependencies:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db7cfd3 acb5ad44e' or one of its dependencies. The system cannot find the file specified

I'm also trying to work something out using 开发者_如何学运维IeUnit, but currently I have no idea how to use it in a C# program.

Does anyone have any libraries to recommend/any other method of getting the data?


Try just sendkeys and use the tab button to move through links, enter to goto hyperlinks, and f5 to refresh.


Try Selenium. IMHO its much better than Watin.

Download with the C# (Selenium WebDriver) link.

Edit: First tutorial that popped up on google. Looks ok.


I answered a similar question recommending HtmlUnit under .NET: Looking for a simple C# scraping library with JavaScript support


I have also used watin API for screen scraping, from the exception you have posted, does not reflect any problem in your code. You must be have missed a reference to the "Interop.SHDocVw.dll" file or else if you had added a reference, please do it again.

If this does not help you out then please check that .NET framework is properly installed in your machine and .dll file are there in the assembly to load from. I was getting the same problem and I solved it in this way.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜