Option Explicit
' Save As ...
Sub sbSaveAs()
Dim driver As ChromeDriver
Set driver = New ChromeDriver
Dim sURL As String
Dim we As WebElement
sURL = "https://user10186832.wordpress.com/2023/03/08/simple-blog/"
Dim sFilename As String
Call driver.Start("edge")
driver.get (sURL)
driver.Window.Maximize
sbDelay (100000)
Set we = driver.FindElementByXPath("/html")
sFilename = "C:\Users\david\Downloads\out-" & Format(Now(), "yyyymmddHHMMSS") & ".txt"
Open sFilename For Output As #1
Print #1, we.FindElementByXPath("/html").Attribute("outerHTML")
Close #1
driver.Quit
End Sub
Sub sbDelay(delay As Long): Dim i As Long: For i = 1 To delay: DoEvents: Next i: End Sub 'old skool delay
1条答案
按热度按时间9gm1akwq1#
尝试以下代码,它可以在不使用
SEND_KEYS
的情况下完成Save As ...
菜单项的操作