最近使用WebBrower做了几个Hook小程序,收集积累如下: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms;// namespace WebBrowser网页操作 { public class Element { //根据Name获取元素 public HtmlElement GetElement_Name(Web
在拼接绝对路径的网址时,经常需要从Request.Url中获取根网址(比如http://www.cnblogs.com),然后与相对路径一起拼接为绝对路径. 以前的做法如下: var uri = Request.Url.Scheme + "://" + Request.Url.Host + "/aggsite/topviews"; 今天发现了更简单的方法: var uri = Request.Url.GetLeftPart(UriPartial.Authority)
常见的获取控件并点击(自动登录): var txtUserID = wbsTask.Document.All["userName"]; var txtPsd = wbsTask.Document.All["password"]; var txtVrf = wbsTask.Document.All["code"];var btnSubmit = wbsTask.Document.All["btnSubmit"]; var cod
public void FindKeyWord(string keyWord) { WebBrowser wb = new WebBrowser(); foreach (HtmlElement item in wb.Document.All) { if (item.InnerText != null) { if (ClearChar(item.InnerText) == keyWord) { Point point = GetPoint(item); wb.Document.Window.Scr