Files
armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_dom.bas
louiscklaw 8719fe58b8 update,
2025-02-01 01:59:56 +08:00

29 lines
635 B
QBasic

Attribute VB_Name = "usage_dom"
Private Sub Get_DOM_1()
Dim driver As New ChromeDriver
driver.Get "https://en.wikipedia.org/wiki/Main_Page"
Dim html As Object
Set html = CreateObject("htmlfile")
html.Open
html.Write driver.PageSource()
html.Close
Debug.Print html.body.innerText
driver.Quit
End Sub
Private Sub Get_DOM_2()
Dim driver As New ChromeDriver
driver.Get "https://en.wikipedia.org/wiki/Main_Page"
Dim html As Object
Set html = CreateObject("htmlfile")
html.body.innerHTML = driver.ExecuteScript("return document.body.innerHTML;")
Debug.Print html.body.innerText
driver.Quit
End Sub