private void FindXPath(FindAction findElementAction) { if (string.IsNullOrEmpty(findElementAction.XPath)) { return; } LoggerManager.Debug("FindElementTask FindXPath"); HtmlElement element = this.GetData(findElementAction) as HtmlElement; if (element == null) { HtmlDocument document = GetHtmlDocument(findElementAction); if (document == null) { LoggerManager.Debug("FindElementTask HtmlDocument document Error"); return; } element = document.Body; } element = HtmlHelp.SelectHtmlNode(findElementAction.XPath, element); this.SaveData(findElementAction, element); }
public void OverNew(HtmlElement h) { IHTMLRect location = HtmlHelp.GetLocation(h); Random random = new Random(); int num = random.Next(location.left, location.right); int num2 = random.Next(location.top, location.bottom); IntPtr handle = this.webBrowser.Handle; StringBuilder lpClassName = new StringBuilder(100); while (lpClassName.ToString() != "Internet Explorer_Server") { handle = Win32API.GetWindow(handle, 5); Win32API.GetClassName(handle, lpClassName, lpClassName.Capacity); } IntPtr lParam = (IntPtr)((num2 << 0x10) | num); IntPtr zero = IntPtr.Zero; Win32API.SendMessage(handle, 0x2a1, zero, lParam); }