Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kinuasa/8efedd752ce787fa506900cc427c3382 to your computer and use it in GitHub Desktop.
Save kinuasa/8efedd752ce787fa506900cc427c3382 to your computer and use it in GitHub Desktop.
SeleniumBasicで指定した要素の背景色を変更するVBAマクロ 関連Tweet:https://twitter.com/kinuasa/status/1440559227026563074
Option Explicit
Public Sub Sample()
With CreateObject("Selenium.EdgeDriver")
.Get "https://www.ka-net.org/blog/"
Dim elm As Object 'Selenium.WebElement
Set elm = .FindElementByXPath("/html/body/div[1]/div/a/span")
.ExecuteScript "arguments[0].setAttribute('style', 'background-color:cyan')", elm
Stop
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment