Note: Advice in this article will only work for DotNetBrowser 1.
See the corresponding article for DotNetBrowser 2 here.
DotNetBrowser 1.8.1 introduces an ability to get the DOM node at the particular location on the page. TheBrowser.NodeAtPoint()
method returns aDOMNodeAtPoint
object that contains information about DOM node at the location or null when there's no node at this location.
See the following articles on how to find DOM Node by mouse click.
Example
C#
using DotNetBrowser; using DotNetBrowser.DOM; using DotNetBrowser.Events; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GetNodeAtPointSample { /// <summary> /// This sample demonstrates how to get DOM Node at a specific point on the web page. /// </summary> class Program { static void Main(string[] args) { Browser browser = BrowserFactory.Create(); browser.SetSize(700, 500); browser.FinishLoadingFrameEvent += delegate(object sender, FinishLoadingEventArgs e) { if (e.IsMainFrame) { DOMNodeAtPoint nodeAtPoint = browser.NodeAtPoint(50, 50); Console.WriteLine("nodeAtPoint = " + nodeAtPoint.ToString()); } }; browser.LoadURL("http://www.teamdev.com"); } } }
VB.NET
Imports DotNetBrowser Imports DotNetBrowser.DOM Module Module1 ''' <summary> ''' This sample demonstrates how to get DOM Node at a specific point on the web page. ''' </summary> Sub Main() Dim browser As Browser = BrowserFactory.Create() browser.SetSize(700, 500) AddHandler browser.FinishLoadingFrameEvent, sub(sender, e) If e.IsMainFrame Then Dim nodeAtPoint As DOMNodeAtPoint = browser.NodeAtPoint(50, 50) Console.WriteLine("nodeAtPoint = " + nodeAtPoint.ToString()) End If End sub browser.LoadURL("http://www.teamdev.com") End Sub End Module