DotNetBrowser DOM API provides functionality that can be used for finding HTML elements on the loaded web page by different conditions. The following sample code demonstrates how to find all HTML elements by specified tag name:

C#

List<DOMNode> divs = document.GetElementsByTagName("div");


VB.NET

Dim divs As List(Of DOMNode) = document.GetElementsByTagName("div")


If you need to find only first HTML element in the document use the following approach:

C#

DOMElement div = document.GetElementById("myId");


VB.NET

Dim div As DOMElement = document.GetElementById("myId")


In general you can search for HTML elements using different conditions:

C#

DOMElement element = document.GetElementById("myId");
List<DOMNode> elements = document.GetElementsByTagName("div");
List<DOMNode> elements = document.GetElementsByClassName("myClass");
List<DOMNode> elements = document.GetElementsByName("myName");


VB.NET

Dim element As DOMElement = document.GetElementById("myId")
Dim elements As List(Of DOMNode) = document.GetElementsByTagName("div")
Dim elements As List(Of DOMNode) = document.GetElementsByClassName("myClass")
Dim elements As List(Of DOMNode) = document.GetElementsByName("myName")


See the following examples: