C#

using DotNetBrowser;
using DotNetBrowser.DOM;
using DotNetBrowser.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace DOMQuerySelectorSample
{
    class Program
    {
        static void Main(string[] args)
        {
            using (Browser browser = BrowserFactory.Create())
            {
                ManualResetEvent waitEvent = new ManualResetEvent(false);
                browser.FinishLoadingFrameEvent += delegate(object sender, FinishLoadingEventArgs e)
                {
                    if (e.IsMainFrame)
                    {
                        DOMDocument document = e.Browser.GetDocument();
                        DOMElement documentElement = document.DocumentElement;
                        // Get the div with id = "root".
                        DOMNode divRoot = documentElement.QuerySelector("#root");
                        // Get all paragraphs.
                        List<DOMNode> paragraphs = divRoot.QuerySelectorAll("p");

                        foreach (var paragraph in paragraphs)
                        {
                            Console.Out.WriteLine("paragraph.NodeValue = " + ((DOMElement)paragraph).InnerText);
                        }
                        waitEvent.Set();
                    }
                };
                browser.LoadHTML(
                    "<html><body><div id='root'>" +
                    "<p>paragraph1</p>" +
                    "<p>paragraph2</p>" +
                    "<p>paragraph3</p>" +
                    "</div></body></html>");
                waitEvent.WaitOne();
            }
        }
    }
}

VB.NET

Imports DotNetBrowser
Imports DotNetBrowser.DOM
Imports DotNetBrowser.Events
Imports System.Threading

Module DOMQuerySelectorSample
    Sub Main(ByVal args As String())
        Using browser As Browser = BrowserFactory.Create()
            Dim waitEvent As ManualResetEvent = New ManualResetEvent(False)
            AddHandler browser.FinishLoadingFrameEvent, sub(ByVal sender As Object, ByVal e As FinishLoadingEventArgs)

                If e.IsMainFrame Then
                    Dim document As DOMDocument = e.Browser.GetDocument()
                    Dim documentElement As DOMElement = document.DocumentElement
                    Dim divRoot As DOMNode = documentElement.QuerySelector("#root")
                    Dim paragraphs As List(Of DOMNode) = divRoot.QuerySelectorAll("p")

                    For Each paragraph In paragraphs
                        Console.Out.WriteLine("paragraph.NodeValue = " & (CType(paragraph, DOMElement)).InnerText)
                    Next

                    waitEvent.Set()
                End If
            End sub

            browser.LoadHTML("<html><body><div id='root'>" &
                             "<p>paragraph1</p>" &
                             "<p>paragraph2</p>" &
                             "<p>paragraph3</p>" &
                             "</div></body></html>")
            waitEvent.WaitOne()
        End Using
    End Sub
End Module