通过C#控制网页浏览 [英] Control web browsing by C#

查看:115
本文介绍了通过C#控制网页浏览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个部分具有多个信息的基础(单击按钮后出现每个部分)。我想要一个加载html代码,获取所需信息,单击Next按钮并在加载所有信息时移动到下一部分的程序。

There is a base with several information partly(each part appears after clicking a button). I want a program which loads the html code, takes the needed information,clicks the Next button and moves to the next part while all information is loaded.

HttpWebRequest req; 
HttpWebResponse resp; 
StreamReader sr; 
string content; 
req = (HttpWebRequest)WebRequest.Create("testkrok.org.ua/"); 
resp = (HttpWebResponse)req.GetResponse(); 
sr = new StreamReader(resp.GetResponseStream(), Encoding.GetEncoding("windows-1251"));     
content = sr.ReadToEnd(); 
sr.Close(); 



这是我获取HTML代码的方式,但我不知道如何点击按钮(HTML代码中的按钮没有名称标签)以及如何获取代码下一页在此先感谢


This is how I gain HTML code, but I do not know how to ckick the button(the button in HTML code does not have name tag) and how get the code of next page. Thanks in advance

推荐答案

你好Soroush Saadatfar,



如果这完全代码回来了,那就多了难以实现,如果您在windows窗体应用程序中开发,我们可以通过使用webbrowser congtrol实现,通过注入JavaScript来单击下一个按钮,我们可以收集DocumentComplete事件上的数据,



希望这会有效



谢谢
Hello Soroush Saadatfar,

If this is totally code back, it is much difficult to achieve, if your developing in windows form application,we can achieve by using webbrowser congtrol, by injecting JavaScript to click the next button, and we can collect the data on DocumentComplete Event,

Hope this will works

Thanks


这篇关于通过C#控制网页浏览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆