update,
This commit is contained in:
28
task1/task1-ticket1/_ref/Excel/Examples/usage_dom.bas
Normal file
28
task1/task1-ticket1/_ref/Excel/Examples/usage_dom.bas
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
Reference in New Issue
Block a user