2025年8月現在 以下の記事が参考になると思います。
※以下の情報は2025年8月現在使えなくなりました
注)完全に自分用の覚え書きです。
AddArgumentのuser-data-dirや、SetProfileDirは普段使いのChromeではおそらくセキュリティの関係上使えない。
別ディレクトリに専用のProfile保存用ディレクトリを用意することで認証済みブラウザを用意できる。
ログイン処理を省いているので、 .Get “https://mail.google.com/mail/・・・” の次の行あたりにブレイクポイントを設定して実行して手動ログインすること。
以下、Gmailの未読を一気に片付けてくれる優秀なプログラム(笑)
Option Explicit
Sub main()
With New ChromeDriver
'Braveを使う場合
'.SetBinary Environ$("LOCALAPPDATA") & _
' "\BraveSoftware\Brave-Browser\Application\brave.exe"
.AddArgument "--user-data-dir=" & _
"D:\SeleiumBasic\Chrome\[email protected]"
.Get "https://mail.google.com/mail/u/0/?shva=1#search/is%3Aunread"
.Wait 5000
Do While 1
.FindElementByCss("span[role=checkbox]").Click
.Wait 3000
.FindElementByCss("div[aria-label=既読にする]").Click
.Wait 3000
Loop
End With
End Sub



コメント