static void Main(string[] args) { using (Browser browser = BrowserFactory.Create()) { ManualResetEvent waitEvent = new ManualResetEvent(false); browser.FinishLoadingFrameEvent += delegate(object sender, FinishLoadingEventArgs e) { // Wait until main document of the web page is loaded completely. if (e.IsMainFrame) { DOMDocument document = e.Browser.GetDocument(); List <DOMNode> divs = document.GetElementsByTagName("div"); foreach (DOMNode div in divs) { if (div.NodeType == DOMNodeType.ElementNode) { DOMElement divElement = (DOMElement)div; Console.Out.WriteLine(@"class = {0}; offsetTop = {1}; offsetLeft = {2}; offsetWidth = {3}; offsetHeight = {4} ; clientTop = {5}; clientLeft = {6}; clientWidth = {7}; clientHeight = {8} ; scrollTop = {9}; scrollLeft = {10}; scrollWidth = {11}; scrollHeight = {12}" , divElement.GetAttribute("class") , divElement.OffsetTop , divElement.OffsetLeft , divElement.OffsetWidth , divElement.OffsetHeight , divElement.ClientTop , divElement.ClientLeft , divElement.ClientWidth , divElement.ClientHeight , divElement.ScrollTop , divElement.ScrollLeft , divElement.ScrollWidth , divElement.ScrollHeight ); } } waitEvent.Set(); } }; browser.LoadURL("http://www.google.com"); waitEvent.WaitOne(); Thread.Sleep(100000); } }
void LoadClomplete() { var x = 458; var y = 203; var clickCount = 1; BrowserView.InputSimulator.SimulateMouseButtonEvent(MouseButtons.Left, System.Windows.Input.MouseButtonState.Pressed, clickCount, x, y); BrowserView.InputSimulator.SimulateMouseButtonEvent(MouseButtons.Left, System.Windows.Input.MouseButtonState.Released, clickCount, x, y); Thread.Sleep(5000); DOMDocument document = BrowserView.Browser.GetDocument(); List <DOMNode> divs = document.GetElementsByTagName("input"); foreach (DOMNode div in divs) { if (div.NodeType == DOMNodeType.ElementNode) { DOMElement divElement = (DOMElement)div; if (divElement.GetAttribute("class").Contains("yt-uix-form-input-text video-settings-title")) { divElement.SetInnerText("Titulo"); } } } }