<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SeleniumBasic &#8211; まったりエンジニア</title>
	<atom:link href="https://javeo.jp/tag/seleniumbasic/feed/" rel="self" type="application/rss+xml" />
	<link>https://javeo.jp</link>
	<description>ほどほどレベルのプログラミング</description>
	<lastBuildDate>Sat, 27 Jun 2026 15:35:56 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.1</generator>

<image>
	<url>https://javeo.jp/wp-content/uploads/2026/05/cropped-サイトアイコン2-32x32.png</url>
	<title>SeleniumBasic &#8211; まったりエンジニア</title>
	<link>https://javeo.jp</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>【VBA】VBAでもWebDriverWaitを使いたい</title>
		<link>https://javeo.jp/vba-webdriverwait/</link>
					<comments>https://javeo.jp/vba-webdriverwait/#respond</comments>
		
		<dc:creator><![CDATA[ジャベ雄]]></dc:creator>
		<pubDate>Sun, 07 Sep 2025 14:44:23 +0000</pubDate>
				<category><![CDATA[Excel・VBA]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[SeleniumBasic]]></category>
		<category><![CDATA[スクレイピング]]></category>
		<category><![CDATA[マクロ]]></category>
		<guid isPermaLink="false">https://javeo.jp/?p=3569</guid>

					<description><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2024/07/ExcelVBA-1024x512.jpg" class="webfeedsFeaturedVisual" /></p>待機処理が必要な理由 SeleniumでWebサイトを操作するときにありがちな内容がこちら これらを解決するには「要素が存在する・表示される・有効になる」まで待機処理が必要です WebDriverWaitクラスでできるこ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2024/07/ExcelVBA-1024x512.jpg" class="webfeedsFeaturedVisual" /></p><div class="codoc-evacuations" style="display:none;" data-shortcode=""></div>
<div class="wp-block-cocoon-blocks-info-box block-box primary-box">
<p class="wp-block-paragraph">PythonでSeleniumを利用するときに利用必須ともいえるWebDriverWaitとexpected_conditionsですが、残念ながらVBAにはありません</p>



<p class="wp-block-paragraph">この記事では、<strong>VBAでWebDriverWait</strong>+expected_conditions<strong>を再現するクラス</strong>を作り、有用な待機処理を実現します</p>



<p class="wp-block-paragraph">※Pythonの場合はこちらをどうぞ</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-excel-python wp-block-embed-excel-python"><div class="wp-block-embed__wrapper">
https://javeo.jp/python_wait/
</div></figure>
</div>



<h2 class="wp-block-heading">待機処理が必要な理由</h2>



<p class="wp-block-paragraph">SeleniumでWebサイトを操作するときにありがちな内容がこちら</p>



<ul class="wp-block-list">
<li>ページロードが完了していないうちに要素を取得してエラー</li>



<li>JavaScriptで動的に生成されるボタンや入力欄がまだ非表示</li>



<li>ボタンが表示されてもクリック可能になる前に操作しようとしてエラー</li>
</ul>



<p class="wp-block-paragraph">これらを解決するには「要素が存在する・表示される・有効になる」まで待機処理が必要です</p>



<h2 class="wp-block-heading">WebDriverWaitクラスでできること</h2>



<p class="wp-block-paragraph">今回作ったVBAクラス <code>WebDriverWait</code> は、PythonのWebDriverWaitに近い操作性で以下の条件を待機できます</p>



<figure class="wp-block-table"><table><thead><tr><th>メソッド</th><th>説明</th></tr></thead><tbody><tr><td><code>UntilPresence(By)</code></td><td>DOM上に指定した <code>By</code> が存在するまで待機</td></tr><tr><td><code>UntilVisibleLocated(By)</code></td><td>画面上に <code>By</code> で指定した要素が表示されるまで待機 (<code>IsDisplayed</code>)</td></tr><tr><td><code>UntilVisible(element)</code></td><td>指定した <code>WebElement</code> が表示されるまで待機</td></tr><tr><td><code>UntilEnableLocated(By)</code></td><td>画面上に <code>By</code> で指定した要素が利用可能になるまで待機 (<code>IsDisplayed &amp; IsEnabled</code>)</td></tr><tr><td><code>UntilEnable(element)</code></td><td>指定した <code>WebElement</code> が利用可能になるまで待機</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">ポイント：</p>



<ul class="wp-block-list">
<li>成功時は <code>WebElement</code> を返す</li>



<li>タイムアウト時は <code>Nothing</code> を返す</li>



<li>Pythonのように例外処理に頼らずVBAらしい安全な設計</li>
</ul>



<h2 class="wp-block-heading">VBA版WebDriverWaitの実装例</h2>



<p class="wp-block-paragraph">以下のクラスモジュールをVBAに追加してください※クラス名は <strong><code>WebDriverWait</code></strong> にしています</p>



<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2025/09/image.jpg"><img decoding="async" width="1024" height="538" src="https://javeo.jp/wp-content/uploads/2025/09/image-1024x538.jpg" alt="" class="wp-image-3570" srcset="https://javeo.jp/wp-content/uploads/2025/09/image-1024x538.jpg 1024w, https://javeo.jp/wp-content/uploads/2025/09/image-300x158.jpg 300w, https://javeo.jp/wp-content/uploads/2025/09/image-150x79.jpg 150w, https://javeo.jp/wp-content/uploads/2025/09/image-768x403.jpg 768w, https://javeo.jp/wp-content/uploads/2025/09/image.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<div class="wp-block-cocoon-blocks-toggle-box-1 toggle-wrap toggle-box block-box not-nested-style cocoon-block-toggle"><input id="toggle-checkbox-202509242213270" class="toggle-checkbox" type="checkbox"/><label class="toggle-button" for="toggle-checkbox-202509242213270">プログラムを見る</label><div class="toggle-content">
<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-file="WebDriverWait " data-lang="Visual Basic + VBA"><code>&#39;--- クラス名: WebDriverWait ---
Option Explicit
&#39;====================================================================================================
&#39; PythonのWebDriverWaitの一部を再現したクラス
&#39; ※条件に合致した場合はWebElementを返して一致しなかった場合はNothingを返す
&#39;   - UntilPresenceeLocated・DOM上に指定したelementが表示されるまで待機は発生し得ないから準備していない
&#39;   - UntilPresence・・・・・DOM上に指定したByが表示されるまで待機
&#39;   - UntilVisibleLocated・・画面上に指定したelementが表示されるまで待機（IsDisplayed）
&#39;   - UntilVisible ・・・・・画面上に指定したByが表示されるまで待機（IsDisplayed）
&#39;   - UntilEnableLocated・・画面上に指定したelementが利用できるまで待機（IsDisplayed & IsEnabled）
&#39;   - UntilEnable ・・・・・画面上に指定したByが利用できるまで待機（IsDisplayed & IsEnabled）
&#39;====================================================================================================
Private pDriver As Selenium.WebDriver
Private pTimeout As Double
Private pInterval As Double

Public Sub Init(driver As Selenium.WebDriver, Optional timeoutSeconds As Double = 10, Optional intervalSeconds As Double = 0.5)
    Set pDriver = driver
    pTimeout = timeoutSeconds
    pInterval = intervalSeconds
End Sub

&#39; Presence
Public Function UntilPresence(By As Selenium.By) As Selenium.WebElement
    Dim start As Double: start = Timer
    Dim elem As Selenium.WebElement
    
    Do
        On Error Resume Next
        Set elem = pDriver.FindElement(By)
        On Error GoTo 0
        
        If Not elem Is Nothing Then
            Set UntilPresence = elem
            Exit Function
        End If
        
        DoEvents
        Application.wait Now + TimeSerial(0, 0, pInterval)
    Loop While Timer - start &lt; pTimeout
    
    Set UntilPresence = Nothing
End Function

&#39; Visibility (By指定)
Public Function UntilVisibleLocated(By As Selenium.By) As Selenium.WebElement
    Dim start As Double: start = Timer
    Dim elem As Selenium.WebElement
    
    Do
        On Error Resume Next
        Set elem = pDriver.FindElement(By)
        On Error GoTo 0
        
        If Not elem Is Nothing Then
            If elem.IsDisplayed Then
                Set UntilVisibleLocated = elem
                Exit Function
            End If
        End If
        
        DoEvents
        Application.wait Now + TimeSerial(0, 0, pInterval)
    Loop While Timer - start &lt; pTimeout
    
    Set UntilVisibleLocated = Nothing
End Function

&#39; Visibility (element指定)
Public Function UntilVisible(elem As Selenium.WebElement) As Selenium.WebElement
    Dim start As Double: start = Timer
    
    Do
        If Not elem Is Nothing Then
            If elem.IsDisplayed Then
                Set UntilVisible = elem
                Exit Function
            End If
        End If
        
        DoEvents
        Application.wait Now + TimeSerial(0, 0, pInterval)
    Loop While Timer - start &lt; pTimeout
    
    Set UntilVisible = Nothing
End Function

&#39; Enable (By指定)
Public Function UntilEnableLocated(By As Selenium.By) As Selenium.WebElement
    Dim start As Double: start = Timer
    Dim elem As Selenium.WebElement
    
    Do
        On Error Resume Next
        Set elem = pDriver.FindElement(By)
        On Error GoTo 0
        
        If Not elem Is Nothing Then
            If elem.IsDisplayed And elem.IsEnabled Then
                Set UntilEnableLocated = elem
                Exit Function
            End If
        End If
        
        DoEvents
        Application.wait Now + TimeSerial(0, 0, pInterval)
    Loop While Timer - start &lt; pTimeout
    
    Set UntilEnableLocated = Nothing
End Function

&#39; Enable (element指定)
Public Function UntilEnable(elem As Selenium.WebElement) As Selenium.WebElement
    Dim start As Double: start = Timer
    
    Do
        If Not elem Is Nothing Then
            If elem.IsDisplayed And elem.IsEnabled Then
                Set UntilEnable = elem
                Exit Function
            End If
        End If
        
        DoEvents
        Application.wait Now + TimeSerial(0, 0, pInterval)
    Loop While Timer - start &lt; pTimeout
    
    Set UntilEnable = Nothing
End Function
</code></pre></div>
</div></div>



<h2 class="wp-block-heading">使い方サンプル</h2>



<p class="wp-block-paragraph">このブログの練習用ページでテストできるようにしていますので自由にテストしてください</p>



<p class="wp-block-paragraph">ポイントはInit部分で引数は下記の通りです</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-lang="Visual Basic + VBA"><code>wait.Init driver, {最大待機秒数}, {判定間隔}</code></pre></div>



<div class="wp-block-cocoon-blocks-toggle-box-1 toggle-wrap toggle-box block-box not-nested-style cocoon-block-toggle"><input id="toggle-checkbox-202509242213271" class="toggle-checkbox" type="checkbox"/><label class="toggle-button" for="toggle-checkbox-202509242213271">プログラムを見る</label><div class="toggle-content">
<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-lang="Visual Basic + VBA"><code>Sub test()
    Dim driver As New Selenium.ChromeDriver
    Dim By As New Selenium.By
    
    driver.Get &quot;https://javeo.jp/practice_scraping/&quot;

    Dim wait As New WebDriverWait
    wait.Init driver, 10, 0.5

    &#39; presence_of_element_located(By)
    Dim elemUser As Selenium.WebElement
    Set elemUser = wait.UntilPresence(By.Css(&quot;#input_test&quot;))
    

    &#39; visibility_of_element_located(By)
    Dim elemPass As Selenium.WebElement
    Set elemPass = wait.UntilVisibleLocated(By.Css(&quot;#textarea_test&quot;))

    &#39; element_to_be_clickable(By)
    Dim elemBtn As Selenium.WebElement
    Set elemBtn = wait.UntilClickableLocated(By.Css(&quot;[name=&quot;&quot;checkbox_test&quot;&quot;]&quot;))

    
    elemUser.SendKeys &quot;testuser&quot;
    elemPass.SendKeys &quot;secret&quot;
    elemBtn.Click
End Sub
</code></pre></div>
</div></div>



<h2 class="wp-block-heading">まとめ</h2>



<p class="wp-block-paragraph">個人的にPythonでもSeleniumを使うのでWebDriverWaitが使えない不便さを感じていました</p>



<p class="wp-block-paragraph">PythonとVBAでは思想も違うので適当にいじってますが、ほぼ同じように使えてスッキリです！</p>
]]></content:encoded>
					
					<wfw:commentRss>https://javeo.jp/vba-webdriverwait/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】VBA-JSON不要！VBAでChromedriverを自動更新</title>
		<link>https://javeo.jp/vba-chromedriver-auto-update-lite/</link>
					<comments>https://javeo.jp/vba-chromedriver-auto-update-lite/#respond</comments>
		
		<dc:creator><![CDATA[ジャベ雄]]></dc:creator>
		<pubDate>Sun, 07 Sep 2025 13:09:12 +0000</pubDate>
				<category><![CDATA[Excel・VBA]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[SeleniumBasic]]></category>
		<category><![CDATA[スクレイピング]]></category>
		<category><![CDATA[マクロ]]></category>
		<guid isPermaLink="false">https://javeo.jp/?p=3564</guid>

					<description><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2024/07/ExcelVBA-1024x512.jpg" class="webfeedsFeaturedVisual" /></p>やっていること 以前作成したVBAはJSON API endpointsを総当たりで取得していたのでJSONをパースする必要がありましたが、APIでドライバのバージョンを直接取得できることに気づいて少し手順を簡略化できま [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2024/07/ExcelVBA-1024x512.jpg" class="webfeedsFeaturedVisual" /></p><div class="codoc-evacuations" style="display:none;" data-shortcode=""></div>
<div class="wp-block-cocoon-blocks-info-box block-box primary-box">
<p class="wp-block-paragraph">以前に別で作成したVBAのChromedriver自動更新プログラムですが色々見直すと実はVBA-JSONなしでも十分ってことに気づいて別途作成しました</p>



<p class="wp-block-paragraph">条件付きの簡略版ではありますのでご自身の環境に合わせて使い分けてください</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-excel-python wp-block-embed-excel-python"><div class="wp-block-embed__wrapper">
https://javeo.jp/vba-chromedriver-auto-update/
</div></figure>
</div>



<h2 class="wp-block-heading">やっていること</h2>



<ol class="wp-block-list has-watery-yellow-background-color has-background">
<li>chromedriverの保存先は端末環境によって違うので候補となる3箇所のフォルダ有無を確認</li>



<li>chromeの保存先も端末環境によって違うので候補となる3箇所のフォルダ有無を確認</li>



<li>PowerShellでchromeのバージョンを取得する<br>※なので一瞬PowerShellの画面がチラつきます</li>



<li>APIでChrome.exeのビルドまで一致している最新chromedriverのダウンロードパスを取得</li>



<li>ダウンロードしたzipファイルを解凍してをseleniumbasic用のフォルダへコピーする</li>
</ol>



<p class="wp-block-paragraph">以前作成したVBAはJSON API endpointsを総当たりで取得していたのでJSONをパースする必要がありましたが、APIでドライバのバージョンを直接取得できることに気づいて少し手順を簡略化できました</p>



<p class="wp-block-paragraph">処理としては数秒しか変わりませんがVBA-JSOＮ不要になったのは個人的にGoodポイント</p>



<p class="is-style-information-box has-box-style wp-block-paragraph">ここからは以前と同じことを書いてますが単独でこのページを見ていただいた方向けです</p>



<h2 class="wp-block-heading">必要な参照設定</h2>



<p class="wp-block-paragraph">このプログラムを実行するために設定した参照設定</p>



<figure class="wp-block-image size-full"><a href="https://javeo.jp/wp-content/uploads/2023/07/image-4.png"><img decoding="async" width="455" height="317" src="https://javeo.jp/wp-content/uploads/2023/07/image-4.png" alt="" class="wp-image-3282" srcset="https://javeo.jp/wp-content/uploads/2023/07/image-4.png 455w, https://javeo.jp/wp-content/uploads/2023/07/image-4-300x209.png 300w, https://javeo.jp/wp-content/uploads/2023/07/image-4-150x105.png 150w" sizes="(max-width: 455px) 100vw, 455px" /></a></figure>



<p class="wp-block-paragraph">追加したのは下記3つ</p>



<ul class="wp-block-list has-watery-yellow-background-color has-background">
<li>Microsoft Scripting Runtime</li>



<li>Microsoft XML, v6.0</li>



<li>Selenium Type Library</li>
</ul>



<p class="wp-block-paragraph">ここは旧バージョンと変わりありません</p>



<h2 class="wp-block-heading">ファイルへの反映手順</h2>



<p class="wp-block-paragraph">サンプルファイルとソースは下部に準備していますがファイルへの反映方法がわからない方向けに反映と使い方です</p>



<p class="wp-block-paragraph">そんなことわかってるからはよソースを！って方は<a href="#program-source" data-type="internal" data-id="#program-source">下部のソース</a>まで飛んじゃってください</p>



<h3 class="wp-block-heading">プロパティウィンドウを表示しておく</h3>



<p class="wp-block-paragraph">あとからモジュール名を変更したいので、もし表示されていない時は表示しておく</p>



<div class="wp-block-cocoon-blocks-blank-box-1 blank-box block-box">
<p class="wp-block-paragraph">ヘッダーメニュー：表示　→　プロパティウィンドウ　※F4がショートカットキー</p>
</div>



<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44.png"><img decoding="async" width="1024" height="555" src="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-1024x555.png" alt="" class="wp-image-1298" srcset="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-1024x555.png 1024w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-300x163.png 300w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-150x81.png 150w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-768x416.png 768w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-1536x832.png 1536w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h3 class="wp-block-heading">標準モジュールを追加</h3>



<p class="wp-block-paragraph">自動更新プログラム用にモジュールを追加する</p>



<div class="wp-block-cocoon-blocks-blank-box-1 blank-box block-box">
<p class="wp-block-paragraph">ヘッダーメニュー：挿入　→　標準モジュール</p>
</div>



<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54.png"><img decoding="async" width="1024" height="555" src="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-1024x555.png" alt="" class="wp-image-1299" srcset="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-1024x555.png 1024w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-300x163.png 300w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-150x81.png 150w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-768x416.png 768w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-1536x832.png 1536w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h3 class="wp-block-heading">モジュール名を変更する</h3>



<p class="wp-block-paragraph">必須ではないんですが、わかりやすい運用のためにはモジュール名変更推奨です</p>



<p class="wp-block-paragraph">今回は&#8221;<span class="marker-under">ChromeDriverAutoUpdateModule</span>&#8220;にします</p>



<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04.png"><img decoding="async" width="1024" height="555" src="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-1024x555.png" alt="" class="wp-image-1300" srcset="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-1024x555.png 1024w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-300x163.png 300w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-150x81.png 150w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-768x416.png 768w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-1536x832.png 1536w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h3 class="wp-block-heading">プログラムの使い方</h3>



<p class="wp-block-paragraph">「<span class="marker-under">&lt;モジュール名&gt;.&lt;プロシージャ名&gt;()</span>  ※&#8221;&lt;モジュール名&gt;.&#8221;は省略可」でプログラムを呼び出せるので、本体プログラムの最初に「<span class="marker-under">ChromeDriverAutoUpdateModule.ChromeDriverAutoUpdate()</span>」を追加すれば必要なときにchromedriverが自動更新されます</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-file="sample" data-lang="Visual Basic + VBA"><code>Sub main()
&#39;---Chromedriverの自動更新 ※別モジュールを参照
If ChromeDriverAutoUpdateModule.ChromeDriverAutoUpdate Then
    Exit Sub
End If

&#39;－－・－－・－－以下にプログラムを－－・－－・－－
End Sub</code></pre></div>



<h2 class="wp-block-heading">Chromedriverの書き込み権限がない時</h2>



<p class="wp-block-paragraph">Winsows11からセキュリティ周りが厳しくなったのか管理者権限でSeleniumBasicをインストールした場合、Chromedriverを更新しようとすると書き込み権限なしエラーが発生するので対応まとめました</p>



<p class="wp-block-paragraph">画像の通りですが下記手順で権限設定ができます</p>



<ol class="wp-block-list has-watery-blue-background-color has-background">
<li>&#8220;C:\Program Files&#8221;にある&#8221;SeleniumBasic&#8221;フォルダを右クリック</li>



<li>右クリックメニューで&#8221;プロパティ&#8221;をクリック</li>



<li>セキュリティタブに移って&#8221;編集&#8221;ボタンをクリック</li>



<li>&#8220;Users（{コンピュータ名}\Users）&#8221;をクリック</li>



<li>&#8220;フルコントロール&#8221;にチェックがついていないはずなのでクリックしてチェックを付ける</li>



<li>&#8220;適用&#8221;ボタンをクリック</li>
</ol>



<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25.png"><img decoding="async" width="1024" height="538" src="https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-1024x538.png" alt="" class="wp-image-3175" srcset="https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-1024x538.png 1024w, https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-300x158.png 300w, https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-150x79.png 150w, https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-768x403.png 768w, https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h2 class="wp-block-heading">サンプルファイル</h2>



<p class="wp-block-paragraph">JSON-VBA含めて最低限のモジュールをセットしたファイル準備したので一から作る時のベースにしていただければ</p>





<h2 class="wp-block-heading" id="program-source">最後に実際のソース</h2>



<p class="wp-block-paragraph">まずはGithubをご利用の方向けはこちら</p>



<p class="wp-block-paragraph"><a href="https://github.com/javeo2022/webdriver_manager_VBA_Lite" target="_blank" rel="noreferrer noopener">https://github.com/javeo2022/webdriver_manager_VBA_Lite</a></p>



<p class="wp-block-paragraph">例によってコピペ用はこちらです</p>



<div class="wp-block-cocoon-blocks-toggle-box-1 toggle-wrap toggle-box block-box not-nested-style cocoon-block-toggle"><input id="toggle-checkbox-202510131456140" class="toggle-checkbox" type="checkbox"/><label class="toggle-button" for="toggle-checkbox-202510131456140">ソースを見る</label><div class="toggle-content">
<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-lang="Visual Basic + VBA"><code>Option Explicit
#If VBA7 Then
Private Declare PtrSafe Function URLDownloadToFile Lib &quot;urlmon&quot; Alias &quot;URLDownloadToFileA&quot; _
                        (ByVal pCaller As Long, _
                         ByVal szURL As String, _
                         ByVal szFileName As String, _
                         ByVal dwReserved As Long, _
                         ByVal lpfnCB As Long) As Long
Private Declare PtrSafe Function SHCreateDirectoryEx Lib &quot;shell32.dll&quot; Alias &quot;SHCreateDirectoryExA&quot; _
                        (ByVal hwnd As LongPtr, ByVal pszPath As String, ByVal psa As LongPtr) As Long
#Else
Private Declare Function URLDownloadToFile Lib &quot;urlmon&quot; Alias &quot;URLDownloadToFileA&quot; _
                        (ByVal pCaller As Long, _
                         ByVal szURL As String, _
                         ByVal szFileName As String, _
                         ByVal dwReserved As Long, _
                         ByVal lpfnCB As Long) As Long
Private Declare Function SHCreateDirectoryEx Lib &quot;shell32.dll&quot; Alias &quot;SHCreateDirectoryExA&quot; _
                        (ByVal hwnd As LongPtr, ByVal pszPath As String, ByVal psa As LongPtr) As Long
#End If

Private Type VersionType &#39;---本当はクラスオブジェクトにしたいけどこれだけのためにモジュール作りたくない
    Major As Long
    Minor As Long
    Build As Long
    Revision As Long
    BuildVersion As String
    RevisionVersion As String
End Type
Const ZIP_FILE As String = &quot;chromedriver.zip&quot;
Const DRIVER_EXE As String = &quot;chromedriver.exe&quot;
Dim workPath As String
Sub test()
Call ChromeDriverAutoUpdate
End Sub
Public Function ChromeDriverAutoUpdate(Optional ByVal ForcedExecution As Boolean = False) As Boolean
&#39;====================================================================================================
&#39;chrome.exeとchromedriver.exeのバージョンを比較してchromedriverを自動更新する
&#39;もしくは強制実行フラグ（ForcedExecution）がTrueでも実行する
&#39;====================================================================================================
    Dim chromePath As String &#39;---chrome.exeが保存されているパス
    Dim chromeFullpath As String &#39;---chrome.exeまで含めたフルパス
    Dim chromeVersion As VersionType
    Dim chromedriverPath As String
    Dim chromedriverFullPath As String
    Dim objFso As New Scripting.FileSystemObject
    &#39; ---chromedriverをダウンロード用のフォルダを作成する　※Seleniumのキャッシュ構造に合わせている
    workPath = Environ(&quot;USERPROFILE&quot;) & &quot;\.cache\selenium\seleniumbasic&quot;
    Select Case SHCreateDirectoryEx(0&, workPath, 0&)
        Case 0:
            &#39; ---作成成功
        Case 183
            &#39; ---作成済み
        Case Else:
            &#39; ---作成できなかった時
            MsgBox &quot;ダウンロード用フォルダを作成できませんでした&quot; & vbCrLf & Error(Err), vbCritical
            ChromeDriverAutoUpdate = False
            Exit Function
    End Select
    
    &#39;---chrome本体のフォルダを探す
    Select Case True
        Case objFso.FolderExists(Environ(&quot;LOCALAPPDATA&quot;) & &quot;\Google\Chrome\Application&quot;)
            chromePath = Environ(&quot;LOCALAPPDATA&quot;) & &quot;\Google\Chrome\Application&quot;
        Case objFso.FolderExists(Environ(&quot;ProgramW6432&quot;) & &quot;\Google\Chrome\Application&quot;)
            chromePath = Environ(&quot;ProgramW6432&quot;) & &quot;\Google\Chrome\Application&quot;
        Case objFso.FolderExists(Environ(&quot;ProgramFiles&quot;) & &quot;\Google\Chrome\Application&quot;)
            chromePath = Environ(&quot;ProgramFiles&quot;) & &quot;\Google\Chrome\Application&quot;
        Case Else
            MsgBox &quot;&#39;chrome&#39;フォルダが見つかりません&quot;, vbCritical
            ChromeDriverAutoUpdate = False
            Exit Function
    End Select
    
    &#39;---念のためchrome.exeを確認する
    If objFso.FileExists(chromePath & &quot;\chrome.exe&quot;) = True Then
        chromeFullpath = chromePath & &quot;\chrome.exe&quot;
    Else
        MsgBox &quot;&#39;chrome.exe&#39;が見つかりません&quot;, vbCritical
        Exit Function
    End If
    
    &#39;---SeleniumBasicのフォルダを探す
    Select Case True
        Case objFso.FolderExists(Environ(&quot;LOCALAPPDATA&quot;) & &quot;\SeleniumBasic&quot;)
            chromedriverPath = Environ(&quot;LOCALAPPDATA&quot;) & &quot;\SeleniumBasic&quot;
        Case objFso.FolderExists(Environ(&quot;ProgramW6432&quot;) & &quot;\SeleniumBasic&quot;)
            chromedriverPath = Environ(&quot;ProgramW6432&quot;) & &quot;\SeleniumBasic&quot;
        Case objFso.FolderExists(Environ(&quot;ProgramFiles&quot;) & &quot;\SeleniumBasic&quot;)
            chromedriverPath = Environ(&quot;ProgramFiles&quot;) & &quot;\SeleniumBasic&quot;
        Case Else
            MsgBox &quot;&#39;SeleniumBasic&#39;のフォルダが見つかりません&quot;, vbCritical
            ChromeDriverAutoUpdate = False
            Exit Function
    End Select
    
    &#39;---念のためchromedriver.exeを確認する
    If objFso.FileExists(chromedriverPath & &quot;\&quot; & DRIVER_EXE) = False Then
        Debug.Print &quot;&#39;chromedriver.exe&#39;が見つかりませんでした&quot;
    End If
    chromedriverFullPath = chromedriverPath & &quot;\&quot; & DRIVER_EXE
        
    &#39;---chrome.exeのバージョンを取得する
    If GetChromeVersion(chromeFullpath, chromeVersion) = False Then &#39;---chrome.exeのバージョンを取得する
        MsgBox &quot;&#39;chrome.exe&#39;のバージョンが取得できませんでした&quot;, vbCritical
        ChromeDriverAutoUpdate = False
        Exit Function
    End If
    
    &#39;---chrome.exeのバージョンに合わせたchromedriver.exeをダウンロードする
    If ChromedriverQuickCheck(chromedriverPath, chromeVersion) = False Then &#39;---chromedriverのバージョンを取得する
        MsgBox &quot;&#39;chromedriver.exe&#39;のバージョンが取得できませんでした&quot;, vbCritical
        ChromeDriverAutoUpdate = False
        Exit Function
    End If
    
    &#39;---結果として更新していない場合もあるが、更新失敗じゃなくて更新不要な判定だからTrueを返す
    ChromeDriverAutoUpdate = True
Exit Function
ErrLabel:     &#39;---予期せぬエラーの分岐
    MsgBox &quot;chromedriver の入替に失敗しました&quot; & vbCrLf & Error(Err) & vbCrLf & &quot;※この画面のキャプチャを作成者へ送ってください&quot;
    ChromeDriverAutoUpdate = False
End Function
Private Function GetChromeVersion(ByVal chromeFullpath As String, ByRef chromeVersion As VersionType) As Boolean
&#39;====================================================================================================
&#39;PowerShellでchrome.exeのバージョン情報を取得する　※一瞬PowerShellが立ち上がる
&#39;====================================================================================================
    Dim command As String
    Dim objRet As Object
    
    On Error GoTo ErrLabel
        &#39;---chromeバージョン情報の初期値
        chromeVersion.Major = 1
        chromeVersion.Minor = 0
        chromeVersion.Build = 0
        chromeVersion.Revision = 0
        &#39;---chrome.exeのバージョンを取得するPowerShellコマンド
        command = &quot;powershell.exe -NoProfile -ExecutionPolicy Bypass (Get-Item -Path &#39;&quot; & chromeFullpath & &quot;&#39;).VersionInfo.FileVersion&quot;
        &#39;---PowerShellの実行結果をセット
        Set objRet = CreateObject(&quot;WScript.Shell&quot;).Exec(command)
        &#39;---PowerShellのコマンドレットの実行結果を取得
        chromeVersion.RevisionVersion = Trim(objRet.StdOut.ReadAll)
        &#39;---情報の取得が終わったらオブジェクトをクリアする
        Set objRet = Nothing
        &#39;---改行コードが含まれているから削除する
        chromeVersion.RevisionVersion = Trim(Replace(Replace(Replace(chromeVersion.RevisionVersion, vbCrLf, vbNullString), vbCr, vbNullString), vbLf, vbNullString))
        &#39;---バージョン情報を分けて返す
        With CreateObject(&quot;VBScript.RegExp&quot;) &#39;---正規表現の準備
            .Pattern = &quot;\d+\.\d+\.\d+(\.\d+)?&quot;
            .Global = True
            If .test(chromeVersion.RevisionVersion) Then &#39;---念のため正規表現でバージョン情報をチェックする
                chromeVersion.Major = CLng(Split(chromeVersion.RevisionVersion, &quot;.&quot;)(0))
                chromeVersion.Minor = CLng(Split(chromeVersion.RevisionVersion, &quot;.&quot;)(1))
                chromeVersion.Build = CLng(Split(chromeVersion.RevisionVersion, &quot;.&quot;)(2))
                If UBound(Split(chromeVersion.RevisionVersion, &quot;.&quot;)) &gt;= 3 Then &#39;---リビジョン番号がなければ9999を仮でセット※基本あるはず
                    chromeVersion.Revision = CLng(Split(chromeVersion.RevisionVersion, &quot;.&quot;)(3))
                Else
                    chromeVersion.Revision = 9999
                End If
                chromeVersion.BuildVersion = Join(Array(chromeVersion.Major, chromeVersion.Minor, chromeVersion.Build), &quot;.&quot;) &#39;---リビジョンを覗いたショートバージョン情報をセットする
                Debug.Print &quot;Chromeのバージョン：&quot; & chromeVersion.RevisionVersion
            Else &#39;---正規表現不一致なら失敗で返す
                MsgBox &quot;chrome.exe のバージョン情報取得に失敗しました&quot; & vbCrLf & &quot;[取得バージョン情報：&quot; & chromeVersion.RevisionVersion & &quot;]&quot; & vbCrLf & &quot;※この画面のキャプチャを作成者へ送ってください&quot;
                GetChromeVersion = False
                Exit Function
            End If
        End With
        GetChromeVersion = True
    On Error GoTo 0
    Exit Function
ErrLabel:     &#39;---予期せぬエラーの分岐
    MsgBox &quot;chrome.exe のバージョン情報取得に失敗しました&quot; & vbCrLf & &quot;[&quot; & Error(Err) & &quot;]&quot; & vbCrLf & &quot;※この画面のキャプチャを作成者へ送ってください&quot;
    GetChromeVersion = False
End Function
Private Function ChromedriverQuickCheck(chromedriverPath, chromeVersion As VersionType) As Boolean
    Dim objHttp As New MSXML2.XMLHTTP60
    Dim targetVarsion As String
    Dim uri As String
    Dim api_endpoints As String
    Dim downloadPath As String
    Dim objFso As New Scripting.FileSystemObject
    Const TARGET_PLATFORM As String = &quot;win64&quot;

    api_endpoints = &quot;https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_&quot; & chromeVersion.BuildVersion
    On Error GoTo ErrLabel
        With objHttp
            .Open &quot;GET&quot;, api_endpoints, False
            .Send
            targetVarsion = .responseText &#39;---JSON endpoints から情報を収集する
            downloadPath = workPath & &quot;\&quot; & targetVarsion
            &#39;--- 念のためリビジョンバージョンを比較する
            If chromeVersion.Major &gt;= CLng(Split(targetVarsion, &quot;.&quot;)(0)) Then
                &#39;--- まだダウンロードしていなかったらダウンロードする
                If objFso.FileExists(downloadPath & &quot;\&quot; & DRIVER_EXE) = False Then
                    uri = &quot;https://storage.googleapis.com/chrome-for-testing-public/&quot; & targetVarsion & &quot;/&quot; & TARGET_PLATFORM & &quot;/chromedriver-&quot; & TARGET_PLATFORM & &quot;.zip&quot;
                    Call DownloadChromedriver(uri, targetVarsion)
                    Call objFso.DeleteFile(chromedriverPath & &quot;\&quot; & DRIVER_EXE, True)
                    Debug.Print &quot;インストールしたChromedriverのバージョン：&quot; & targetVarsion
                End If
                &#39;--- chromedriverはいつでも上書きする
                Call objFso.GetFile(downloadPath & &quot;\&quot; & DRIVER_EXE).Copy(chromedriverPath & &quot;\&quot; & DRIVER_EXE, True)
            Else
                Debug.Print &quot;Chromeのバージョンが古いためChromedriverは更新しません&quot;
            End If
        End With
    On Error GoTo 0
    ChromedriverQuickCheck = True
    Exit Function
ErrLabel:     &#39;---予期せぬエラーの分岐
    MsgBox &quot;chromedriver.exe の更新に失敗しました&quot; & vbCrLf & &quot;[&quot; & Error(Err) & &quot;]&quot; & vbCrLf & &quot;※この画面のキャプチャを作成者へ送ってください&quot;
    ChromedriverQuickCheck = False
End Function
Private Function DownloadChromedriver(ByVal url As String, targetVersion As String) As Boolean
    Dim rc As Long
    Dim downloadPath As String
    Dim newDriverPath As String
    Dim objFso As New Scripting.FileSystemObject
    Dim objFolder As Scripting.Folder
    downloadPath = workPath & &quot;\&quot; & targetVersion
    &#39; ---chromedriverのフォルダを作成する
    Select Case SHCreateDirectoryEx(0&, downloadPath, 0&)
        Case 0:
            &#39; ---作成成功
        Case 183
            &#39; ---作成済み
        Case Else:
            &#39; ---作成できなかった時
            MsgBox &quot;ChromeDriver用フォルダを作成できませんでした&quot; & vbCrLf & Error(Err), vbCritical
            DownloadChromedriver = False
            Exit Function
    End Select
    
    &#39;---ファイルをダウンロードする
    If URLDownloadToFile(0, url, workPath & &quot;\&quot; & ZIP_FILE, 0, 0) &lt;&gt; 0 Then
        MsgBox &quot;ChromeDriverをダウンロードできませんでした&quot; & vbCrLf & Error(Err), vbCritical
        DownloadChromedriver = False
        Exit Function
    End If
    Application.DisplayAlerts = False
    &#39;---zipを既定のフォルダに向けて解凍する
    With CreateObject(&quot;Shell.Application&quot;) &#39;---zipを既定のフォルダに向けて解凍する
        .Namespace((downloadPath)).CopyHere .Namespace((workPath & &quot;\&quot; & ZIP_FILE)).Items
    End With
    &#39;--- 解凍したフォルダから再起処理してchromedriver.exeのフルパスを取得する
    newDriverPath = SearchFilesRecursively(downloadPath & &quot;\&quot;, &quot;chromedriver.exe&quot;)
    If newDriverPath = &quot;&quot; Then
        MsgBox &quot;chromedriver.exe の更新に失敗しました&quot;
        DownloadChromedriver = False
    End If
    &#39;---chromedriverをバージョンフォルダ直下に移動する
    Call objFso.MoveFile(newDriverPath, downloadPath & &quot;\&quot;)
    &#39;---chromedriverがなくなった不要フォルダを削除する
    For Each objFolder In objFso.GetFolder(downloadPath).SubFolders
        objFolder.Delete True
    Next
    &#39;---zipファイルを削除する
    Call objFso.DeleteFile(workPath & &quot;\&quot; & ZIP_FILE, True)
    Application.DisplayAlerts = True
    DownloadChromedriver = True
End Function
Function SearchFilesRecursively(ByVal folderPath As String, fileName As String) As String
    &#39;====================================================================================================
    &#39; folderPathを起点に再帰処理でサブフォルダまで対象にしてfileNameを探してフルパスを返す
    &#39;====================================================================================================
    Dim objFso As New Scripting.FileSystemObject
    Dim objFolder As Scripting.Folder
    Dim subFolder As Scripting.Folder
    Dim objFile As Scripting.File
    Dim result As String

    &#39; ファイル一覧をチェック
    For Each objFile In objFso.GetFolder(folderPath).Files
        If objFile.Name = fileName Then
            SearchFilesRecursively = objFile.Path
            Exit Function
        End If
    Next objFile

    &#39; サブフォルダを再帰的に探索
    For Each subFolder In objFso.GetFolder(folderPath).SubFolders
        result = SearchFilesRecursively(subFolder.Path, fileName)
        If result &lt;&gt; &quot;&quot; Then
            SearchFilesRecursively = result
            Exit Function
        End If
    Next subFolder

    &#39; 見つからなかった場合
    SearchFilesRecursively = &quot;&quot;
End Function
</code></pre></div>
</div></div>



<h2 class="wp-block-heading">あとがき</h2>



<p class="wp-block-paragraph">こちらが後出しなので簡易版としましたがむしろこちらを正規版で過去作成した方を特殊版にした方がいいかなと思っているレベル</p>



<p class="wp-block-paragraph">今後改修するとしたらこちらになる予定です</p>
]]></content:encoded>
					
					<wfw:commentRss>https://javeo.jp/vba-chromedriver-auto-update-lite/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】SeleniumBasicのchromedriverを自動更新する</title>
		<link>https://javeo.jp/vba-chromedriver-auto-update/</link>
					<comments>https://javeo.jp/vba-chromedriver-auto-update/#comments</comments>
		
		<dc:creator><![CDATA[ジャベ雄]]></dc:creator>
		<pubDate>Thu, 27 Jul 2023 23:00:00 +0000</pubDate>
				<category><![CDATA[Excel・VBA]]></category>
		<category><![CDATA[ChromeDriver]]></category>
		<category><![CDATA[SeleniumBasic]]></category>
		<category><![CDATA[自動化]]></category>
		<guid isPermaLink="false">https://javeo.jp/?p=1281</guid>

					<description><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2026/06/vba-chromedriver-auto-update-1024x538.jpg" class="webfeedsFeaturedVisual" /></p>PythonのSeleniumはchromedriverをchromeに合わせて自動更新する方法が確立していますが、VBA用のSeleniumBasicにはそんな機能備わっていないので独自に作ってみました 手間が減るのは [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2026/06/vba-chromedriver-auto-update-1024x538.jpg" class="webfeedsFeaturedVisual" /></p><div class="codoc-evacuations" style="display:none;" data-shortcode=""></div>
<div class="wp-block-group is-style-big_icon_memo"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">PythonのSeleniumはchromedriverをchromeに合わせて自動更新する方法が確立していますが、VBA用のSeleniumBasicにはそんな機能備わっていないので<strong><span class="swl-marker mark_yellow">独自に作ってみました</span></strong></p>



<p class="wp-block-paragraph">手間が減るのはもちろん、プログラムを誰かに渡した時にchromedriverの入替を案内する必要がなくなるのでSeleniumBasic界隈では歓喜してもらえるはず！</p>



<p class="wp-block-paragraph">当然私も使っているプログラムなので必要に応じて改修もしますので何かあればコメントください</p>



<p class="wp-block-paragraph">※このページのプログラムは<strong><span class="swl-marker mark_yellow">chromeのバージョン115以上が前提</span></strong>です</p>
</div></div>



<p class="wp-block-paragraph">なお、ドライバーの更新そのものを自動でやってくれる「SeleniumVBA」という選択肢もあります、手動更新が面倒に感じるなら<a href="https://javeo.jp/selenium-vba/" target="_blank" rel="noopener noreferrer">SeleniumVBAの使い方</a>も検討してみてください</p>



<div class="swell-block-capbox cap_box"><div class="cap_box_ttl"><span>更新情報</span></div><div class="cap_box_content">
<p class="wp-block-paragraph">2025/08/03</p>



<ul class="wp-block-list">
<li>プログラム微調整しました</li>



<li>フォルダへの書き込み権限がない時の対応を追記しました</li>
</ul>



<p class="wp-block-paragraph">2025/08/15</p>



<ul class="wp-block-list">
<li>プログラムを大幅に見直しました</li>
</ul>
</div></div>



<h2 class="wp-block-heading">このプログラムにはVBA-JSONが必要です</h2>



<p class="wp-block-paragraph">後述しますがchromedriverの情報を収集する際に情報がJSONが必要になるため<strong><span class="swl-marker mark_yellow" style="color:#e8313b">VBA-JSONとセットで利用する必要があります</span></strong></p>



<p class="wp-block-paragraph">VBA-JSONは別でまとめていますので知らない方は↓↓を参照</p>



<figure class="wp-block-embed is-type-wp-embed"><div class="wp-block-embed__wrapper">
https://javeo.jp/vba-json
</div></figure>



<p class="wp-block-paragraph">もう一点、SeleniumBasicとVBA-JSONの組み合わせだと特有のエラーが発生するので↓↓を参考に調整必要なのでご注意を</p>



<figure class="wp-block-embed is-type-wp-embed"><div class="wp-block-embed__wrapper">
https://javeo.jp/vba-json-error
</div></figure>



<h2 class="wp-block-heading">やっていること</h2>



<p class="wp-block-paragraph">結構プログラムが長くなってしまったのでざっくりやってることを順番にまとめました</p>



<ol class="wp-block-list is-style-num_circle">
<li>chromedriverの保存先は端末環境によって違うので候補となる3箇所のフォルダ有無を確認</li>



<li>chromeの保存先も端末環境によって違うので候補となる3箇所のフォルダ有無を確認</li>



<li>PowerShellでchromeのバージョンを取得する<br>※なので一瞬PowerShellの画面がチラつきます</li>



<li>chromeとビルドまで一致しているchromedriverを<a href="https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json" data-type="link" data-id="https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json" target="_blank" rel="noopener noreferrer">JSON endpoints</a>から全てダウンロード</li>



<li>リビジョンがchrome以下の中で最大値のchromedriverをseleniumbasic用のフォルダへコピーする</li>
</ol>



<p class="wp-block-paragraph">ざっくりとした動きはこんな感じ</p>



<p class="wp-block-paragraph">ちなみに、本当はchromedriverのバージョン情報を調べる方法はchromedriver.exeを実行してログを正規表現なんかで解析した方が確実だと思うのですが、実行エラーになったり、最後にクローズできなかったりと環境依存なのかエラーが発生することが多いので諦めました・・・</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2023/07/2023-07-26_18h14_03.png"><img decoding="async" width="979" height="512" src="https://javeo.jp/wp-content/uploads/2023/07/2023-07-26_18h14_03.png" alt="chromedriver自動更新プログラムの実行イメージ" class="wp-image-1284" srcset="https://javeo.jp/wp-content/uploads/2023/07/2023-07-26_18h14_03.png 979w, https://javeo.jp/wp-content/uploads/2023/07/2023-07-26_18h14_03-300x157.png 300w, https://javeo.jp/wp-content/uploads/2023/07/2023-07-26_18h14_03-150x78.png 150w, https://javeo.jp/wp-content/uploads/2023/07/2023-07-26_18h14_03-768x402.png 768w" sizes="(max-width: 979px) 100vw, 979px" /></a></figure>



<h2 class="wp-block-heading">必要な参照設定</h2>



<p class="wp-block-paragraph">このプログラムを実行するために設定した参照設定</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2023/07/image-4.png"><img decoding="async" width="455" height="317" src="https://javeo.jp/wp-content/uploads/2023/07/image-4.png" alt="VBAの参照設定ダイアログ(Scripting Runtime・XML・Selenium)" class="wp-image-3282" srcset="https://javeo.jp/wp-content/uploads/2023/07/image-4.png 455w, https://javeo.jp/wp-content/uploads/2023/07/image-4-300x209.png 300w, https://javeo.jp/wp-content/uploads/2023/07/image-4-150x105.png 150w" sizes="(max-width: 455px) 100vw, 455px" /></a></figure>



<p class="wp-block-paragraph">追加したのは下記3つ</p>



<ul class="wp-block-list is-style-check_list">
<li>Microsoft Scripting Runtime</li>



<li>Microsoft XML, v6.0</li>



<li>Selenium Type Library</li>
</ul>



<p class="wp-block-paragraph">Seleniumは自動更新には必要ないんですが、Seleniumのためのプロジェクトなので一応</p>



<h2 class="wp-block-heading">ファイルへの反映手順</h2>



<p class="wp-block-paragraph">サンプルファイルとソースは下部に準備していますがファイルへの反映方法がわからない方向けに反映と使い方です</p>



<p class="wp-block-paragraph">そんなことわかってるからはよソースを！って方は<a href="#program-source" data-type="internal" data-id="#program-source">下部のソース</a>まで飛んじゃってください</p>



<h3 class="wp-block-heading">プロパティウィンドウを表示しておく</h3>



<p class="wp-block-paragraph">あとからモジュール名を変更したいので、もし表示されていない時は表示しておく</p>



<div class="wp-block-group is-style-kakko_box"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">ヘッダーメニュー：表示　→　プロパティウィンドウ　※F4がショートカットキー</p>
</div></div>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44.png"><img decoding="async" width="1024" height="555" src="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-1024x555.png" alt="VBEのプロパティウィンドウを表示する" class="wp-image-1298" srcset="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-1024x555.png 1024w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-300x163.png 300w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-150x81.png 150w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-768x416.png 768w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44-1536x832.png 1536w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_44.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h3 class="wp-block-heading">標準モジュールを追加</h3>



<p class="wp-block-paragraph">自動更新プログラム用にモジュールを追加する</p>



<div class="wp-block-group is-style-kakko_box"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">ヘッダーメニュー：挿入　→　標準モジュール</p>
</div></div>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54.png"><img decoding="async" width="1024" height="555" src="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-1024x555.png" alt="VBEで標準モジュールを追加する" class="wp-image-1299" srcset="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-1024x555.png 1024w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-300x163.png 300w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-150x81.png 150w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-768x416.png 768w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54-1536x832.png 1536w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h03_54.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h3 class="wp-block-heading">モジュール名を変更する</h3>



<p class="wp-block-paragraph">必須ではないんですが、わかりやすい運用のためにはモジュール名変更推奨です</p>



<p class="wp-block-paragraph">今回は&#8221;<strong><span class="swl-marker mark_yellow">ChromeDriverAutoUpdateModule</span></strong>&#8220;にします</p>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04.png"><img decoding="async" width="1024" height="555" src="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-1024x555.png" alt="VBEでモジュール名をChromeDriverAutoUpdateModuleに変更する" class="wp-image-1300" srcset="https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-1024x555.png 1024w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-300x163.png 300w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-150x81.png 150w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-768x416.png 768w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04-1536x832.png 1536w, https://javeo.jp/wp-content/uploads/2023/08/2023-08-01_09h05_04.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h3 class="wp-block-heading">プログラムの使い方</h3>



<p class="wp-block-paragraph">「<strong><span class="swl-marker mark_yellow">&lt;モジュール名&gt;.&lt;プロシージャ名&gt;()</span></strong>  ※&#8221;&lt;モジュール名&gt;.&#8221;は省略可」でプログラムを呼び出せるので、本体プログラムの最初に「<strong><span class="swl-marker mark_yellow">ChromeDriverAutoUpdateModule.ChromeDriverAutoUpdate()</span></strong>」を追加すれば必要なときにchromedriverが自動更新されます</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-file="sample" data-lang="Visual Basic + VBA"><code>Sub main()
&#39;---Chromedriverの自動更新 ※別モジュールを参照
If ChromeDriverAutoUpdateModule.ChromeDriverAutoUpdate Then
    Exit Sub
End If

&#39;－－・－－・－－以下にプログラムを－－・－－・－－
End Sub</code></pre></div>



<h2 class="wp-block-heading">今後の課題</h2>



<p class="wp-block-paragraph">とりあえず問題なく動くことを確認していますが、もう少し作りこんだ方がいい気もするので気が向いた時に今わかっている課題を確認しようと備忘として残しておきます</p>



<ul class="wp-block-list is-style-check_list">
<li><s>今までなかったwin64は使うべき？？※今のところwin32で問題なく動いてる</s></li>



<li><s>chromedriverファイルをダウンロードするURLは決め打ちしてるけど本当はJSON API endpoints（<a href="https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json" target="_blank" rel="noopener noreferrer"><strong>known-good-versions-with-downloads.json</strong></a>）から条件に合わせてURL検索した方が良さそう</s></li>



<li><s>相変わらずリビジョン番号だけの相違だけならchromedriverは動くようなので更新条件を緩和してもいい？</s></li>
</ul>



<div class="wp-block-group is-style-big_icon_good"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph"><s>2023/8/15の更新で一部対応しました</s></p>
</div></div>



<div class="wp-block-group is-style-big_icon_good"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph"><s>2025/7/22の更新でconfig.iniの保存場所を変えました（ユーザー権限次第で&#8221;C:\Program Files&#8221;配下のフォルダにファイルを作成できない場合があるため）</s></p>
</div></div>



<div class="wp-block-group is-style-big_icon_good"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">2025/08/15の更新で大幅な仕様変更をして対応しました</p>
</div></div>



<h2 class="wp-block-heading">Chromedriverの書き込み権限がない時</h2>



<p class="wp-block-paragraph">Winsows11からセキュリティ周りが厳しくなったのか管理者権限でSeleniumBasicをインストールした場合、Chromedriverを更新しようとすると<strong><span class="swl-marker mark_yellow">書き込み権限なしエラー</span></strong>が発生するので対応まとめました</p>



<p class="wp-block-paragraph">画像の通りですが下記手順で権限設定ができます</p>



<ol class="wp-block-list is-style-num_circle">
<li>&#8220;C:\Program Files&#8221;にある&#8221;SeleniumBasic&#8221;フォルダを右クリック</li>



<li>右クリックメニューで&#8221;プロパティ&#8221;をクリック</li>



<li>セキュリティタブに移って&#8221;編集&#8221;ボタンをクリック</li>



<li>&#8220;Users（{コンピュータ名}\Users）&#8221;をクリック</li>



<li>&#8220;フルコントロール&#8221;にチェックがついていないはずなのでクリックしてチェックを付ける</li>



<li>&#8220;適用&#8221;ボタンをクリック</li>
</ol>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25.png"><img decoding="async" width="1024" height="538" src="https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-1024x538.png" alt="SeleniumBasicフォルダのセキュリティ設定でUsersにフルコントロールを付与する" class="wp-image-3175" srcset="https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-1024x538.png 1024w, https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-300x158.png 300w, https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-150x79.png 150w, https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25-768x403.png 768w, https://javeo.jp/wp-content/uploads/2023/07/2025-08-01_08h03_25.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h2 class="wp-block-heading">サンプルファイル</h2>



<p class="wp-block-paragraph">JSON-VBA含めて最低限のモジュールをセットしたファイル準備したので一から作る時のベースにしていただければ</p>



<div class="wp-block-file"><a id="wp-block-file--media-b6f63ec0-4e75-4476-b186-6181eb4a4f4a" href="https://javeo.jp/wp-content/uploads/2025/08/SeleniumBasicTool.xlsm">SeleniumBasicTool</a><a href="https://javeo.jp/wp-content/uploads/2025/08/SeleniumBasicTool.xlsm" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-b6f63ec0-4e75-4476-b186-6181eb4a4f4a">ダウンロード</a></div>



<h2 id="program-source" class="wp-block-heading">最後に実際のソース</h2>



<p class="wp-block-paragraph">まずはGithubをご利用の方向けはこちら</p>



<p class="wp-block-paragraph"><a href="https://github.com/javeo2022/webdriver_manager_VBA" target="_blank" rel="noopener noreferrer">https://github.com/javeo2022/webdriver_manager_VBA</a></p>



<p class="wp-block-paragraph">かなり長いですがコピペ用はこちらです</p>



<div class="swell-block-accordion">
<details class="swell-block-accordion__item" data-swl-acc="wrapper"><summary class="swell-block-accordion__title" data-swl-acc="header"><span class="swell-block-accordion__label">ソースを開く</span><span class="swell-block-accordion__icon c-switchIconBtn" data-swl-acc="icon" aria-hidden="true" data-opened="false"><i class="__icon--closed icon-caret-down"></i><i class="__icon--opened icon-caret-up"></i></span></summary><div class="swell-block-accordion__body" data-swl-acc="body">
<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-file="ChromeDriverAutoUpdateModule" data-lang="Visual Basic + VBA"><code>Option Explicit
#If VBA7 Then
Private Declare PtrSafe Function GetPrivateProfileString Lib &quot;kernel32&quot; Alias &quot;GetPrivateProfileStringA&quot; _
                         (ByVal lpApplicationName As String, _
                          ByVal lpKeyName As Any, _
                          ByVal lpDefault As String, _
                          ByVal lpReturnedString As String, _
                          ByVal nSize As Long, _
                          ByVal lpFileName As String) As Long
                           
Private Declare PtrSafe Function WritePrivateProfileString Lib &quot;kernel32&quot; Alias &quot;WritePrivateProfileStringA&quot; _
                         (ByVal lpApplicationName As String, _
                          ByVal lpKeyName As Any, _
                          ByVal lpString As Any, _
                          ByVal lpFileName As String) As Long
                           
Private Declare PtrSafe Function URLDownloadToFile Lib &quot;urlmon&quot; Alias &quot;URLDownloadToFileA&quot; _
                        (ByVal pCaller As Long, _
                         ByVal szURL As String, _
                         ByVal szFileName As String, _
                         ByVal dwReserved As Long, _
                         ByVal lpfnCB As Long) As Long
Private Declare PtrSafe Function SHCreateDirectoryEx Lib &quot;shell32.dll&quot; Alias &quot;SHCreateDirectoryExA&quot; _
                        (ByVal hwnd As LongPtr, ByVal pszPath As String, ByVal psa As LongPtr) As Long
#Else
Private Declare Function GetPrivateProfileString Lib &quot;kernel32&quot; Alias &quot;GetPrivateProfileStringA&quot; _
                         (ByVal lpApplicationName As String, _
                          ByVal lpKeyName As Any, _
                          ByVal lpDefault As String, _
                          ByVal lpReturnedString As String, _
                          ByVal nSize As Long, _
                          ByVal lpFileName As String) As Long
                           
Private Declare Function WritePrivateProfileString Lib &quot;kernel32&quot; Alias &quot;WritePrivateProfileStringA&quot; _
                         (ByVal lpApplicationName As String, _
                          ByVal lpKeyName As Any, _
                          ByVal lpString As Any, _
                          ByVal lpFileName As String) As Long
                           
Private Declare Function URLDownloadToFile Lib &quot;urlmon&quot; Alias &quot;URLDownloadToFileA&quot; _
                        (ByVal pCaller As Long, _
                         ByVal szURL As String, _
                         ByVal szFileName As String, _
                         ByVal dwReserved As Long, _
                         ByVal lpfnCB As Long) As Long
Private Declare Function SHCreateDirectoryEx Lib &quot;shell32.dll&quot; Alias &quot;SHCreateDirectoryExA&quot; _
                        (ByVal hwnd As LongPtr, ByVal pszPath As String, ByVal psa As LongPtr) As Long
#End If

Private Type VersionType &#39;---本当はクラスオブジェクトにしたいけどこれだけのためにモジュール作りたくない
    Major As Long
    Minor As Long
    Build As Long
    Revision As Long
    BuildVersion As String
    RevisionVersion As String
End Type
Const ZIP_FILE As String = &quot;chromedriver.zip&quot;
Dim workPath As String
Dim objFso As New Scripting.FileSystemObject
Public Function ChromeDriverAutoUpdate(Optional ByVal ForcedExecution As Boolean = False) As Boolean
&#39;====================================================================================================
&#39;chrome.exeとchromedriver.exeのバージョンを比較してchromedriverを自動更新する
&#39;もしくは強制実行フラグ（ForcedExecution）がTrueでも実行する
&#39;====================================================================================================
    Dim chromePath As String &#39;---chrome.exeが保存されているパス
    Dim chromeFullpath As String &#39;---chrome.exeまで含めたフルパス
    Dim chromeVersion As VersionType
    Dim chromedriverPath As String
    Dim chromedriverFullPath As String
    Dim objFolder As Scripting.Folder
    Dim lngRevision As Long
    Dim targetRevision As Long
    
    &#39; ---chromedriverをダウンロード用のフォルダを作成する　※Pythonに合わせてる
    workPath = Environ(&quot;USERPROFILE&quot;) & &quot;\.cache\selenium\seleniumbasic&quot;
    Select Case SHCreateDirectoryEx(0&, workPath, 0&)
        Case 0:
            &#39; ---作成成功
        Case 183
            &#39; ---作成済み
        Case Else:
            &#39; ---作成できなかった時
            MsgBox &quot;ダウンロード用フォルダを作成できませんでした&quot; & vbCrLf & Error(Err), vbCritical
    End Select
    
    &#39;---chrome本体のフォルダを探す
    Select Case True
        Case objFso.FolderExists(Environ(&quot;ProgramW6432&quot;) & &quot;\Google\Chrome\Application&quot;)
            chromePath = Environ(&quot;ProgramW6432&quot;) & &quot;\Google\Chrome\Application&quot;
        Case objFso.FolderExists(Environ(&quot;ProgramFiles&quot;) & &quot;\Google\Chrome\Application&quot;)
            chromePath = Environ(&quot;ProgramFiles&quot;) & &quot;\Google\Chrome\Application&quot;
        Case objFso.FolderExists(Environ(&quot;LOCALAPPDATA&quot;) & &quot;\Google\Chrome\Application&quot;)
            chromePath = Environ(&quot;LOCALAPPDATA&quot;) & &quot;\Google\Chrome\Application&quot;
        Case Else
            MsgBox &quot;&#39;chrome&#39;フォルダが見つかりません&quot;, vbCritical
            ChromeDriverAutoUpdate = False
            Exit Function
    End Select
    
    &#39;---念のためchrome.exeを確認する
    If objFso.FileExists(chromePath & &quot;\chrome.exe&quot;) = True Then
        chromeFullpath = chromePath & &quot;\chrome.exe&quot;
    Else
        MsgBox &quot;&#39;chrome.exe&#39;が見つかりません&quot;, vbCritical
        Exit Function
    End If
    
    &#39;---SeleniumBasicのフォルダを探す
    Select Case True
        Case objFso.FolderExists(Environ(&quot;ProgramW6432&quot;) & &quot;\SeleniumBasic&quot;)
            chromedriverPath = Environ(&quot;ProgramW6432&quot;) & &quot;\SeleniumBasic&quot;
        Case objFso.FolderExists(Environ(&quot;ProgramFiles&quot;) & &quot;\SeleniumBasic&quot;)
            chromedriverPath = Environ(&quot;ProgramFiles&quot;) & &quot;\SeleniumBasic&quot;
        Case objFso.FolderExists(Environ(&quot;LOCALAPPDATA&quot;) & &quot;\SeleniumBasic&quot;)
            chromedriverPath = Environ(&quot;LOCALAPPDATA&quot;) & &quot;\SeleniumBasic&quot;
        Case Else
            MsgBox &quot;&#39;SeleniumBasic&#39;のフォルダが見つかりません&quot;, vbCritical
            ChromeDriverAutoUpdate = False
            Exit Function
    End Select
    
    &#39;---念のためchromedriver.exeを確認する
    If objFso.FileExists(chromedriverPath & &quot;\chromedriver.exe&quot;) = True Then
        chromedriverFullPath = chromedriverPath & &quot;\chromedriver.exe&quot;
    Else
        MsgBox &quot;&#39;chromedriver.exe&#39;が見つかりません&quot;, vbCritical
        ChromeDriverAutoUpdate = False
        Exit Function
    End If
    Set objFso = Nothing
        
    &#39;---chrome.exeのバージョンを取得する
    If GetChromeVersion(chromeFullpath, chromeVersion) = False Then &#39;---chrome.exeのバージョンを取得する
        MsgBox &quot;&#39;chrome.exe&#39;のバージョンが取得できませんでした&quot;, vbCritical
        ChromeDriverAutoUpdate = False
        Exit Function
    End If
    
    &#39;---chrome.exeのバージョンに合わせたchromedriver.exeをダウンロードする
    If ChromedriverCheck(chromedriverPath, chromeVersion) = False Then &#39;---chromedriverのバージョンを取得する
        MsgBox &quot;&#39;chromedriver.exe&#39;のバージョンが取得できませんでした&quot;, vbCritical
        ChromeDriverAutoUpdate = False
        Exit Function
    End If
    
    &#39;---利用するchromedriverのバージョンを探す※リビジョンがchrome以下のバージョンの中で最新を使う
    On Error GoTo ErrLabel
        targetRevision = 0
        For Each objFolder In objFso.GetFolder(workPath).SubFolders
            If objFolder.Name Like chromeVersion.BuildVersion & &quot;*&quot; Then
                lngRevision = CLng(Split(objFolder.Name, &quot;.&quot;)(3))
                If lngRevision &lt;= chromeVersion.Revision Then
                    If targetRevision &lt; lngRevision Then
                        targetRevision = lngRevision
                    End If
                End If
            Else
                Call objFolder.Delete(True)
            End If
        Next
        Call objFso.GetFile(workPath & &quot;\&quot; & chromeVersion.BuildVersion & &quot;.&quot; & CStr(targetRevision) & &quot;\chromedriver.exe&quot;).Copy(chromedriverPath & &quot;\chromedriver.exe&quot;, True)
    On Error GoTo 0
    
    &#39;---結果として更新していない場合もあるが、更新失敗じゃなくて更新不要な判定だからTrueを返す
    ChromeDriverAutoUpdate = True
Exit Function
ErrLabel:     &#39;---予期せぬエラーの分岐
    MsgBox &quot;chromedriver の入替に失敗しました&quot; & vbCrLf & Error(Err) & vbCrLf & &quot;※この画面のキャプチャを作成者へ送ってください&quot;
    ChromeDriverAutoUpdate = False
End Function
Private Function GetChromeVersion(ByVal chromeFullpath As String, ByRef chromeVersion As VersionType) As Boolean
&#39;====================================================================================================
&#39;PowerShellでchrome.exeのバージョン情報を取得する　※一瞬PowerShellが立ち上がる
&#39;====================================================================================================
    Dim command As String
    Dim objRet As Object
    
    On Error GoTo ErrLabel
        &#39;---chromeバージョン情報の初期値
        chromeVersion.Major = 1
        chromeVersion.Minor = 0
        chromeVersion.Build = 0
        chromeVersion.Revision = 0
        &#39;---chrome.exeのバージョンを取得するPowerShellコマンド
        command = &quot;powershell.exe -NoProfile -ExecutionPolicy Bypass (Get-Item -Path &#39;&quot; & chromeFullpath & &quot;&#39;).VersionInfo.FileVersion&quot;
        &#39;---PowerShellの実行結果をセット
        Set objRet = CreateObject(&quot;WScript.Shell&quot;).Exec(command)
        &#39;---PowerShellのコマンドレットの実行結果を取得
        chromeVersion.RevisionVersion = Trim(objRet.StdOut.ReadAll)
        &#39;---情報の取得が終わったらオブジェクトをクリアする
        Set objRet = Nothing
        &#39;---改行コードが含まれているから削除する
        chromeVersion.RevisionVersion = Trim(Replace(Replace(Replace(chromeVersion.RevisionVersion, vbCrLf, vbNullString), vbCr, vbNullString), vbLf, vbNullString))
        &#39;---バージョン情報を分けて返す
        With CreateObject(&quot;VBScript.RegExp&quot;) &#39;---正規表現の準備
            .Pattern = &quot;\d+\.\d+\.\d+(\.\d+)?&quot;
            .Global = True
            If .test(chromeVersion.RevisionVersion) Then &#39;---念のため正規表現でバージョン情報をチェックする
                chromeVersion.Major = CLng(Split(chromeVersion.RevisionVersion, &quot;.&quot;)(0))
                chromeVersion.Minor = CLng(Split(chromeVersion.RevisionVersion, &quot;.&quot;)(1))
                chromeVersion.Build = CLng(Split(chromeVersion.RevisionVersion, &quot;.&quot;)(2))
                If UBound(Split(chromeVersion.RevisionVersion, &quot;.&quot;)) &gt;= 3 Then chromeVersion.Revision = CLng(Split(chromeVersion.RevisionVersion, &quot;.&quot;)(3)) &#39;---リビジョン番号があれば※基本あるはず
                chromeVersion.BuildVersion = Join(Array(chromeVersion.Major, chromeVersion.Minor, chromeVersion.Build), &quot;.&quot;) &#39;---リビジョンを覗いたショートバージョン情報をセットする
            Else &#39;---正規表現不一致なら失敗で返す
                GetChromeVersion = False
                Exit Function
            End If
        End With
        GetChromeVersion = True
    On Error GoTo 0
    Exit Function
ErrLabel:     &#39;---予期せぬエラーの分岐
    MsgBox &quot;chrome.exe のバージョン情報取得に失敗しました&quot; & vbCrLf & &quot;[&quot; & Error(Err) & &quot;]&quot; & vbCrLf & &quot;※この画面のキャプチャを作成者へ送ってください&quot;
    GetChromeVersion = False
End Function
Private Function ChromedriverCheck(chromedriverPath, chromeVersion As VersionType) As Boolean
    Dim rc As Long
    Dim url As String
    Dim objHttp As New MSXML2.XMLHTTP60
    Dim objRet As Scripting.Dictionary
    Dim objVersion As Scripting.Dictionary
    Dim idx As Variant
    Dim chromedriver As Variant
    
    Const JSON_ENDPOINTS_URL As String = &quot;https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json&quot;
    Const TARGET_PLATFORM As String = &quot;win64&quot;

    On Error GoTo ErrLabel
        With objHttp
            .Open &quot;GET&quot;, JSON_ENDPOINTS_URL, False
            .Send
            Set objRet = JsonConverter.ParseJson(.responseText) &#39;---JSON endpoints から情報を収集する
            &#39;---バージョン情報を照合しながら取得対象チェックする
            For Each objVersion In objRet(&quot;versions&quot;)
                &#39;---ビルドまで一致していれば取得候補にする
                If objVersion(&quot;version&quot;) Like chromeVersion.BuildVersion & &quot;*&quot; Then
                    &#39;---古い情報はchromedriverがインデックスにない場合があるので念のためインデックスチェックする
                    For Each idx In objVersion(&quot;downloads&quot;)
                        If idx = &quot;chromedriver&quot; Then
                            For Each chromedriver In objVersion(&quot;downloads&quot;)(idx)
                                &#39;---取得済みフォルダになかったら
                                If objFso.FolderExists(workPath & &quot;\&quot; & objVersion(&quot;version&quot;)) = False Then
                                    &#39;---対象のplatformかチェックする ※Winsows11から64bitしかないので決め打ち
                                    If chromedriver(&quot;platform&quot;) = TARGET_PLATFORM Then
                                        url = chromedriver(&quot;url&quot;)
                                        If DownloadChromedriver(url, objVersion(&quot;version&quot;)) = False Then
                                            MsgBox &quot;chromedriverのダウンロードに失敗しました&quot;, vbCritical
                                            ChromedriverCheck = False
                                            Exit Function
                                        End If
                                    End If
                                End If
                            Next
                        End If
                    Next
                End If
            Next
            Set objRet = Nothing
        End With
    On Error GoTo 0
    ChromedriverCheck = True
    Exit Function
ErrLabel:     &#39;---予期せぬエラーの分岐
    MsgBox &quot;chromedriver.exe の更新に失敗しました&quot; & vbCrLf & &quot;[&quot; & Error(Err) & &quot;]&quot; & vbCrLf & &quot;※この画面のキャプチャを作成者へ送ってください&quot;
    ChromedriverCheck = False
End Function
Private Function DownloadChromedriver(ByVal url As String, targetVersion As String) As Boolean
    Dim rc As Long
    Dim downloadPath As String
    Dim newDriverPath As String
    Dim objFolder As Scripting.Folder
    downloadPath = workPath & &quot;\&quot; & targetVersion
    &#39; ---chromedriverのフォルダを作成する
    Select Case SHCreateDirectoryEx(0&, downloadPath, 0&)
        Case 0:
            &#39; ---作成成功
        Case 183
            &#39; ---作成済み
        Case Else:
            &#39; ---作成できなかった時
            MsgBox &quot;ChromeDriver用フォルダを作成できませんでした&quot; & vbCrLf & Error(Err), vbCritical
            DownloadChromedriver = False
            Exit Function
    End Select
    
    &#39;---ファイルをダウンロードする
    If URLDownloadToFile(0, url, workPath & &quot;\&quot; & ZIP_FILE, 0, 0) &lt;&gt; 0 Then
        MsgBox &quot;ChromeDriverをダウンロードできませんでした&quot; & vbCrLf & Error(Err), vbCritical
        DownloadChromedriver = False
        Exit Function
    End If
    Application.DisplayAlerts = False
    &#39;---zipを既定のフォルダに向けて解凍する
    With CreateObject(&quot;Shell.Application&quot;) &#39;---zipを既定のフォルダに向けて解凍する
        .Namespace((downloadPath)).CopyHere .Namespace((workPath & &quot;\&quot; & ZIP_FILE)).Items
    End With
    &#39;--- 解凍したフォルダから再起処理してchromedriver.exeのフルパスを取得する
    newDriverPath = SearchFilesRecursively(downloadPath & &quot;\&quot;, &quot;chromedriver.exe&quot;)
    If newDriverPath = &quot;&quot; Then
        MsgBox &quot;chromedriver.exe の更新に失敗しました&quot;
        DownloadChromedriver = False
    End If
    &#39;---chromedriverをバージョンフォルダ直下に移動する
    Call objFso.MoveFile(newDriverPath, downloadPath & &quot;\&quot;)
    &#39;---chromedriverがなくなった不要フォルダを削除する
    For Each objFolder In objFso.GetFolder(downloadPath).SubFolders
        objFolder.Delete True
    Next
    &#39;---zipファイルを削除する
    Call objFso.DeleteFile(workPath & &quot;\&quot; & ZIP_FILE, True)
    Application.DisplayAlerts = True
    DownloadChromedriver = True
End Function
Function SearchFilesRecursively(ByVal folderPath As String, fileName) As String
&#39;====================================================================================================
&#39; folderPathを起点に再起処理でサブフォルダまで対象にしてfileNameを探してフルパスを返す
&#39;====================================================================================================
    Dim objFolder As Scripting.Folder
    Dim subFolder As Scripting.Folder
    Dim objFile As Scripting.File
    
    &#39; ファイル一覧表示
    For Each objFile In objFso.GetFolder(folderPath).Files
        If objFile.Name = fileName Then
            SearchFilesRecursively = objFile.Path
            Exit Function
        End If
    Next objFile
    
    &#39; サブフォルダを再帰的に探索
    For Each subFolder In objFso.GetFolder(folderPath).SubFolders
        If SearchFilesRecursively(subFolder.Path, fileName) = subFolder.Path & &quot;\&quot; & fileName Then
            SearchFilesRecursively = subFolder.Path & &quot;\&quot; & fileName
            Exit Function
        End If
    Next subFolder
    SearchFilesRecursively = &quot;&quot;
End Function</code></pre></div>
</div></details>
</div>



<h2 class="wp-block-heading">あとがき</h2>



<p class="wp-block-paragraph">SeleniumはスクレイピングだけじゃなくてRPA的にも使えて本当に便利なんですが、SeleniumBasicはPythonとかのSeleniumに比べて機能が少ないので独自に追加してあげると使い勝手が爆上がりです</p>



<p class="wp-block-paragraph">自作でにPythonにある機能を移植するだけでもかなり変わってくると思うのでちょっとずつでもモジュールを作っていきたいです</p>


<div class="p-blogParts post_content" data-partsID="4601">
<div class="jv-books" id="jv-books-vba" data-shelf="vba"><div class="jv-books-head"><span class="jv-books-title"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4da.png" alt="📚" class="wp-smiley" style="height: 1em; max-height: 1em;" /> VBAの独学に効く本</span><span class="jv-books-pr">PR</span></div><div class="jv-books-grid"><div class="jv-book-card"><a class="jv-book-cover" href="https://www.amazon.co.jp/dp/4839975728?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/5722/9784839975722_1_2.jpg?_ex=240x240" alt="Excel VBA塾【動画×本で学ぶ!】" width="120" height="170" loading="lazy"></a><div class="jv-book-info"><p class="jv-book-title">Excel VBA塾【動画×本で学ぶ!】</p><p class="jv-book-author">たてばやし淳</p><div class="jv-book-btns"><a class="jv-btn jv-btn-az" href="https://www.amazon.co.jp/dp/4839975728?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="amazon" data-book="4839975728">Amazonで見る</a><a class="jv-btn jv-btn-rk" href="https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16918602%2F&#038;m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16918602%2F" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="rakuten" data-book="4839975728">楽天で見る</a></div></div></div><div class="jv-book-card"><a class="jv-book-cover" href="https://www.amazon.co.jp/dp/4297108755?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/8755/9784297108755.jpg?_ex=240x240" alt="パーフェクトExcel VBA" width="120" height="170" loading="lazy"></a><div class="jv-book-info"><p class="jv-book-title">パーフェクトExcel VBA</p><p class="jv-book-author">高橋宣成</p><div class="jv-book-btns"><a class="jv-btn jv-btn-az" href="https://www.amazon.co.jp/dp/4297108755?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="amazon" data-book="4297108755">Amazonで見る</a><a class="jv-btn jv-btn-rk" href="https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16076590%2F&#038;m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16076590%2F" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="rakuten" data-book="4297108755">楽天で見る</a></div></div></div><div class="jv-book-card"><a class="jv-book-cover" href="https://www.amazon.co.jp/dp/4815631298?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/1291/9784815631291.jpg?_ex=240x240" alt="Excel マクロ&amp;VBA［実践ビジネス入門講座］完全版 第3版" width="120" height="170" loading="lazy"></a><div class="jv-book-info"><p class="jv-book-title">Excel マクロ&amp;VBA［実践ビジネス入門講座］完全版 第3版</p><p class="jv-book-author">国本温子</p><div class="jv-book-btns"><a class="jv-btn jv-btn-az" href="https://www.amazon.co.jp/dp/4815631298?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="amazon" data-book="4815631298">Amazonで見る</a><a class="jv-btn jv-btn-rk" href="https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F18165619%2F&#038;m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F18165619%2F" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="rakuten" data-book="4815631298">楽天で見る</a></div></div></div></div><p class="jv-books-note">私のおすすめからランダムで3冊を表示しています</p></div>
<style>
.jv-books{border:1px solid #e0e0e0;border-radius:8px;padding:16px;margin:1.5em 0;background:#fff}
.jv-books-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.jv-books-title{font-weight:700;font-size:1.05em}
.jv-books-pr{font-size:.7em;color:#888;border:1px solid #ccc;border-radius:3px;padding:1px 6px;flex-shrink:0}
.jv-books-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;min-height:330px}
.jv-book-card{display:flex;flex-direction:column;align-items:center;text-align:center;border:1px solid #f0f0f0;border-radius:6px;padding:12px 8px;background:#fafafa}
.jv-book-cover img{width:auto;max-width:120px;height:170px;object-fit:contain}
.jv-book-info{width:100%;flex:1;display:flex;flex-direction:column}
.jv-book-title{font-size:.82em;font-weight:600;line-height:1.4;margin:8px 0 2px;min-height:2.8em;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.jv-book-author{font-size:.72em;color:#777;margin:0 0 8px}
.jv-book-btns{display:flex;flex-direction:column;gap:6px;width:100%;margin-top:auto}
.jv-btn{display:block;text-align:center;font-size:.78em;font-weight:600;color:#fff!important;text-decoration:none!important;border-radius:4px;padding:7px 4px;line-height:1.2}
.jv-btn-az{background:#e88b00}
.jv-btn-rk{background:#bf0000}
.jv-btn:hover{opacity:.85}
.jv-books-note{font-size:.7em;color:#999;text-align:right;margin:8px 0 0}
@media(max-width:599px){
.jv-books-grid{grid-template-columns:1fr;min-height:0}
.jv-book-card{flex-direction:row;text-align:left;gap:12px}
.jv-book-cover img{height:110px;max-width:80px}
.jv-book-info{min-width:0}
.jv-book-title{min-height:0}
.jv-book-btns{flex-direction:row}
.jv-btn{flex:1}
}
</style>
<script>
(function(){
var SHELF='vba';
var root=document.getElementById('jv-books-'+SHELF);
if(!root||root.dataset.init)return;
root.dataset.init='1';
var POOL=[{"t": "Excel VBA塾【動画×本で学ぶ!】", "a": "たてばやし淳", "img": "https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/5722/9784839975722_1_2.jpg?_ex=240x240", "az": "https://www.amazon.co.jp/dp/4839975728?tag=javeo2022-22", "rk": "https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16918602%2F&m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16918602%2F", "id": "4839975728"}, {"t": "パーフェクトExcel VBA", "a": "高橋宣成", "img": "https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/8755/9784297108755.jpg?_ex=240x240", "az": "https://www.amazon.co.jp/dp/4297108755?tag=javeo2022-22", "rk": "https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16076590%2F&m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16076590%2F", "id": "4297108755"}, {"t": "Excel マクロ&VBA［実践ビジネス入門講座］完全版 第3版", "a": "国本温子", "img": "https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/1291/9784815631291.jpg?_ex=240x240", "az": "https://www.amazon.co.jp/dp/4815631298?tag=javeo2022-22", "rk": "https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F18165619%2F&m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F18165619%2F", "id": "4815631298"}, {"t": "増強改訂版 できる イラストで学ぶ 入社1年目からのExcel VBA", "a": "きたみあきこ", "img": "https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/8414/9784295018414.jpg?_ex=240x240", "az": "https://www.amazon.co.jp/dp/4295018414?tag=javeo2022-22", "rk": "https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F17725381%2F&m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F17725381%2F", "id": "4295018414"}];
var REL='nofollow sponsored noopener noreferrer';
function el(tag,cls){var e=document.createElement(tag);if(cls)e.className=cls;return e;}
function btn(href,cls,label,mall,id){
var a=el('a','jv-btn '+cls);a.href=href;a.target='_blank';a.rel=REL;a.textContent=label;
a.setAttribute('data-shelf',SHELF);a.setAttribute('data-mall',mall);a.setAttribute('data-book',id);
return a;}
function card(b){
var d=el('div','jv-book-card');
var cover=el('a','jv-book-cover');cover.href=b.az;cover.target='_blank';cover.rel=REL;
var img=el('img');img.src=b.img;img.alt=b.t;img.width=120;img.height=170;img.loading='lazy';
cover.appendChild(img);
var info=el('div','jv-book-info');
var ttl=el('p','jv-book-title');ttl.textContent=b.t;
var au=el('p','jv-book-author');au.textContent=b.a;
var btns=el('div','jv-book-btns');
btns.appendChild(btn(b.az,'jv-btn-az','Amazonで見る','amazon',b.id));
if(b.rk){btns.appendChild(btn(b.rk,'jv-btn-rk','楽天で見る','rakuten',b.id));}
info.appendChild(ttl);info.appendChild(au);info.appendChild(btns);
d.appendChild(cover);d.appendChild(info);
return d;}
var pool=POOL.slice();
for(var i=pool.length-1;i>0;i--){var j=Math.floor(Math.random()*(i+1));var t=pool[i];pool[i]=pool[j];pool[j]=t;}
var grid=root.querySelector('.jv-books-grid');
grid.style.opacity='0';
while(grid.firstChild)grid.removeChild(grid.firstChild);
pool.slice(0,3).forEach(function(b){grid.appendChild(card(b));});
grid.style.transition='opacity .5s ease';
void grid.offsetWidth;
grid.style.opacity='1';
})();
</script>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://javeo.jp/vba-chromedriver-auto-update/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】EXCELでブラウザ操作ツールを作りたい-準備編</title>
		<link>https://javeo.jp/excel-rpa-preparation/</link>
					<comments>https://javeo.jp/excel-rpa-preparation/#respond</comments>
		
		<dc:creator><![CDATA[ジャベ雄]]></dc:creator>
		<pubDate>Sun, 16 Apr 2023 23:00:00 +0000</pubDate>
				<category><![CDATA[Excel・VBA]]></category>
		<category><![CDATA[RPA]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[SeleniumBasic]]></category>
		<guid isPermaLink="false">https://javeo.jp/?p=1079</guid>

					<description><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2023/01/コンピューターを使うロボットのイラスト-1024x538.jpg" class="webfeedsFeaturedVisual" /></p>本業だけじゃなくてクラウドソーシングの受注でEXCEL＆SeleniumBasicでブラウザ操作ツールを作ることが増えてきたので何回かに分けて作り方とかコツみたいなことをまとめてみます！ EXCELでブラウザ操作ツールを [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2023/01/コンピューターを使うロボットのイラスト-1024x538.jpg" class="webfeedsFeaturedVisual" /></p><div class="codoc-evacuations" style="display:none;" data-shortcode=""></div>
<p class="wp-block-paragraph">本業だけじゃなくてクラウドソーシングの受注で<span class="marker">EXCEL＆SeleniumBasicでブラウザ操作ツール</span>を作ることが増えてきたので何回かに分けて作り方とかコツみたいなことをまとめてみます！</p>



<h2 class="wp-block-heading">EXCELでブラウザ操作ツールを作る理由</h2>



<p class="wp-block-paragraph">最近落ち着いたのかあまり耳にしなくなりましたが、一時期流行っていたRPAツールについて職業柄いくつか触ってきまして・・よく聞く謳い文句としては</p>



<ul class="has-watery-yellow-background-color has-background wp-block-list">
<li>誰でも簡単に作れる</li>



<li>アプリケーション不問で操作できる</li>
</ul>



<p class="wp-block-paragraph">なんでことを耳にしますが、実際そんなことはなく・・・現実は</p>



<ul class="has-watery-green-background-color has-background wp-block-list">
<li>結局ユーザーはEXCEL操作を希望することが多い</li>



<li>RPAツールでのEXCEL操作は歯痒いところに手が届かないことがある</li>



<li>ユーザー希望でEXCEL操作以外はブラウザ（WEBアプリ）操作がほぼ</li>



<li>EXCELとブラウザ以外のアプリは結局RPAツールで連携しにくい</li>



<li>プログラミング知識はいらなくても結局RPAツール知識がいる</li>



<li>プログラミング知識もゼロだと厳しい（知識と言うか経験？）</li>
</ul>



<p class="wp-block-paragraph">ので、結局のところEXCEL（VBA）でブラウザ操作できれば大体の要望満たせるんじゃないかと</p>



<p class="wp-block-paragraph">さらにRPAツールのライセンスって有償のものも多く「<span class="bold-red">触る機会が少ない≒自己学習が難しい</span>」のはマイナスポイント</p>



<p class="wp-block-paragraph">ついでに有償ツールだとクラウドソーシングでの募集も少なく活躍の場がないんですよね・・・</p>



<p class="wp-block-paragraph">とどのつまり「<span class="marker"><span class="bold">EXCEL（VBA）とSeleniumが使いこなせれば十分</span></span>」って結論に至り、公私で活躍しています</p>



<h2 class="wp-block-heading">まずは環境づくり</h2>



<p class="wp-block-paragraph">EXCELはそこにWindowsPCがあればきっとインストールされているでしょう</p>



<p class="wp-block-paragraph">macOSの方はSeleniumがインストールできないのでここでお別れです・・<br>※2023/03時点では私が知らないだけで何か方法があるかもです</p>



<p class="wp-block-paragraph">SeleniumBasicのインストールは過去記事のコチラを参照ください</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-excelとvba、時々pyth wp-block-embed-excelとvba、時々pyth"><div class="wp-block-embed__wrapper">
https://javeo.jp/seleniumbasic-startup/
</div></figure>



<h2 class="wp-block-heading">VBEの参照設定</h2>



<p class="wp-block-paragraph">VBEの画面で参照設定からSeleniumを有効に</p>



<p class="wp-block-paragraph">ツール　→　参照設定　→　<span class="bold"><span class="marker-under">Selenium Type Library</span></span></p>



<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2023/04/2023-04-15_23h41_56.png"><img decoding="async" width="1024" height="537" src="https://javeo.jp/wp-content/uploads/2023/04/2023-04-15_23h41_56-1024x537.png" alt="" class="wp-image-1108" srcset="https://javeo.jp/wp-content/uploads/2023/04/2023-04-15_23h41_56-1024x537.png 1024w, https://javeo.jp/wp-content/uploads/2023/04/2023-04-15_23h41_56-300x157.png 300w, https://javeo.jp/wp-content/uploads/2023/04/2023-04-15_23h41_56-150x79.png 150w, https://javeo.jp/wp-content/uploads/2023/04/2023-04-15_23h41_56-768x403.png 768w, https://javeo.jp/wp-content/uploads/2023/04/2023-04-15_23h41_56.png 1201w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p class="wp-block-paragraph">有効になると当然ながらオブジェクトブラウザーにSeleniumが追加されてクラスやメンバーを見ることができるようになる</p>



<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2023/04/2023-04-16_00h58_32.png"><img decoding="async" width="1024" height="537" src="https://javeo.jp/wp-content/uploads/2023/04/2023-04-16_00h58_32-1024x537.png" alt="" class="wp-image-1112" srcset="https://javeo.jp/wp-content/uploads/2023/04/2023-04-16_00h58_32-1024x537.png 1024w, https://javeo.jp/wp-content/uploads/2023/04/2023-04-16_00h58_32-300x157.png 300w, https://javeo.jp/wp-content/uploads/2023/04/2023-04-16_00h58_32-150x79.png 150w, https://javeo.jp/wp-content/uploads/2023/04/2023-04-16_00h58_32-768x403.png 768w, https://javeo.jp/wp-content/uploads/2023/04/2023-04-16_00h58_32.png 1201w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h2 class="wp-block-heading">サンプルコード</h2>



<p class="wp-block-paragraph">めちゃめちゃ簡単なサンプルコードがコチラ↓↓</p>



<p class="wp-block-paragraph">Google検索で&#8221;ジャベ雄&#8221;を検索してこのサイトのページを見つけたらクリックで開きます</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-lang="Visual Basic + VBA"><code>Sub Sample()
Dim driver As Selenium.ChromeDriver
Dim By As New Selenium.By
Dim element As Selenium.WebElement

Set driver = New Selenium.ChromeDriver
With driver
    &#39;---Chromeを立ち上げる
    .Start
    &#39;---Google検索へ移動
    .Get &quot;https://www.google.com/&quot;
    &#39;---検索ウィンドに&quot;ジャベ雄&quot;を入力
    .FindElement(By.Css(&quot;textarea[type=search]&quot;)).SendKeys &quot;ジャベ雄&quot;
    .Wait 1000
    &#39;---Google 検索ボタンを押下
    .FindElement(By.Css(&quot;input[value=&quot;&quot;Google 検索&quot;&quot;]&quot;)).Click
    .Wait 1000
    &#39;---検索結果の中からこのサイト（&quot;https://javeo.jp/&quot;の前方一致だったらタイトルリンクをクリック
    For Each element In .FindElements(By.Css(&quot;#search &gt; div &gt; div&quot;))
        If element.FindElement(By.Css(&quot;div &gt; div &gt; div &gt; div &gt; a&quot;)).IsDisplayed Then
            If element.FindElement(By.Css(&quot;div &gt; div &gt; div &gt; div &gt; a&quot;)).Attribute(&quot;href&quot;) Like &quot;https://javeo.jp/*&quot; Then
                Call element.FindElement(By.Css(&quot;div &gt; div &gt; div &gt; div &gt; a&quot;)).Click
                .Wait 1000
                Exit For
            End If
        End If
    Next
    &#39;---Chromeを閉じる
    .Close
End With
Set driver = Nothing
End Sub</code></pre></div>



<h2 class="wp-block-heading">あとがき</h2>



<p class="wp-block-paragraph">こんな感じでEXCELでもツールを作れるよ！てことの布教第一歩でした</p>



<p class="wp-block-paragraph">Seleniumの使い道ってスクレイピングだよね？って感覚もありますが私が仕事で使う時は</p>



<ol class="has-watery-blue-background-color has-background wp-block-list">
<li>業務システムAからCSVでデータ取得</li>



<li>EXCELで一覧加工</li>



<li>業務システムBにEXCELの一覧を元に登録</li>
</ol>



<p class="wp-block-paragraph">のような事務職あるあるの時に使っているのでブラウザ操作と言い張らせていただきました！</p>



<p class="wp-block-paragraph">初級編と中級編（できれば上級編も）のページも近く作りたいのでまた見に来てくださいm(_ _)m</p>
]]></content:encoded>
					
					<wfw:commentRss>https://javeo.jp/excel-rpa-preparation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】VBA-JSONで「KeyNotFoundError」エラーが発生する</title>
		<link>https://javeo.jp/vba-json-error/</link>
					<comments>https://javeo.jp/vba-json-error/#comments</comments>
		
		<dc:creator><![CDATA[ジャベ雄]]></dc:creator>
		<pubDate>Sat, 16 Jul 2022 23:00:00 +0000</pubDate>
				<category><![CDATA[Excel・VBA]]></category>
		<category><![CDATA[SeleniumBasic]]></category>
		<guid isPermaLink="false">https://javeo.jp/?p=707</guid>

					<description><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2022/07/2022-07-17_16h41_35-1024x538.jpg" class="webfeedsFeaturedVisual" /></p>ある日突然エラーが発生した まずはエラーメッセージから そのまま受け取るとDictionary型の変数にKeyが無いと ピンと来る理由もないので実際のエラーソースを見てみる 実際のエラー発生箇所 実際にエラーになるのは2 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2022/07/2022-07-17_16h41_35-1024x538.jpg" class="webfeedsFeaturedVisual" /></p><div class="codoc-evacuations" style="display:none;" data-shortcode=""></div>
<div class="wp-block-cocoon-blocks-info-box block-box primary-box">
<p class="wp-block-paragraph">VBA-JSONを使ってる時にエラー「KeyNotFoundError」が発生して解決に結構時間がかかったので備忘半分で原因と解消方法まとめてみました</p>



<p class="wp-block-paragraph">VBA-JSONは何って話はコチラから</p>



<figure class="wp-block-embed is-type-wp-embed"><div class="wp-block-embed__wrapper">
https://javeo.jp/vba-json/
</div></figure>
</div>



<h2 class="wp-block-heading">ある日突然エラーが発生した</h2>



<p class="wp-block-paragraph">まずはエラーメッセージから</p>



<figure class="wp-block-image size-full"><a href="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_21h10_29.png"><img decoding="async" width="427" height="194" src="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_21h10_29.png" alt="" class="wp-image-709" srcset="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_21h10_29.png 427w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_21h10_29-300x136.png 300w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_21h10_29-150x68.png 150w" sizes="(max-width: 427px) 100vw, 427px" /></a></figure>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-file="Err.Description" data-lang="Visual Basic + VBA"><code>KeyNotFoundError
Dictionary key not found: &lt;KeyName&gt;</code></pre></div>



<p class="wp-block-paragraph">そのまま受け取るとDictionary型の変数にKeyが無いと</p>



<p class="wp-block-paragraph">ピンと来る理由もないので実際のエラーソースを見てみる</p>



<h2 class="wp-block-heading">実際のエラー発生箇所</h2>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-lang="Visual Basic + VBA" data-line="27"><code>Private Function json_ParseObject(json_String As String, ByRef json_Index As Long) As Dictionary
    Dim json_Key As String
    Dim json_NextChar As String

    Set json_ParseObject = New Dictionary
    json_SkipSpaces json_String, json_Index
    If VBA.Mid$(json_String, json_Index, 1) &lt;&gt; &quot;{&quot; Then
        Err.Raise 10001, &quot;JSONConverter&quot;, json_ParseErrorMessage(json_String, json_Index, &quot;Expecting &#39;{&#39;&quot;)
    Else
        json_Index = json_Index + 1

        Do
            json_SkipSpaces json_String, json_Index
            If VBA.Mid$(json_String, json_Index, 1) = &quot;}&quot; Then
                json_Index = json_Index + 1
                Exit Function
            ElseIf VBA.Mid$(json_String, json_Index, 1) = &quot;,&quot; Then
                json_Index = json_Index + 1
                json_SkipSpaces json_String, json_Index
            End If

            json_Key = json_ParseKey(json_String, json_Index)
            json_NextChar = json_Peek(json_String, json_Index)
            If json_NextChar = &quot;[&quot; Or json_NextChar = &quot;{&quot; Then
                Set json_ParseObject.Item(json_Key) = json_ParseValue(json_String, json_Index)
            Else
                json_ParseObject.Item(json_Key) = json_ParseValue(json_String, json_Index)
            End If
        Loop
    End If
End Function</code></pre></div>



<p class="wp-block-paragraph">実際にエラーになるのは27行目の部分</p>



<p class="wp-block-paragraph">なにもおかしなソースではないし、そもそも今までエラーにならなかったし同じVBA-JSONを使っているのに急にエラーになってしまう理由がやっぱりわからない・・・</p>



<h2 class="wp-block-heading">原因は「Dictionary」でした</h2>



<p class="wp-block-paragraph">まず前提としてDictionary型と言われると連想することは参照設定だと「M<span class="bold">icrosoft Scripting Runtime</span>」のことを指すと思いますし、私も思ってました</p>



<p class="wp-block-paragraph">が、実は「<strong>Selenium Type Library</strong>」の中にもDictionary型があったのです</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h21_00.png"><img decoding="async" width="838" height="517" src="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h21_00.png" alt="" class="wp-image-714" srcset="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h21_00.png 838w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h21_00-300x185.png 300w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h21_00-150x93.png 150w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h21_00-768x474.png 768w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h21_00-240x148.png 240w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h21_00-320x198.png 320w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h21_00-640x396.png 640w" sizes="(max-width: 838px) 100vw, 838px" /></a><figcaption class="wp-element-caption">「Microsoft Scripting Runtime」のDictionary</figcaption></figure>
</div>

<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h20_53.png"><img decoding="async" width="838" height="517" src="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h20_53.png" alt="" class="wp-image-713" srcset="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h20_53.png 838w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h20_53-300x185.png 300w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h20_53-150x93.png 150w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h20_53-768x474.png 768w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h20_53-240x148.png 240w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h20_53-320x198.png 320w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h20_53-640x396.png 640w" sizes="(max-width: 838px) 100vw, 838px" /></a><figcaption class="wp-element-caption">「Selenium Type Library」のDictionary</figcaption></figure>
</div>


<p class="wp-block-paragraph">つまり「Selenium Type Library」のDictionaryとして動作していたのでエラーになっていたわけです</p>



<h2 class="wp-block-heading">解決方法</h2>



<p class="wp-block-paragraph">原因がわかれば対応方法は難しくなくて2パターンありますので状況に応じてお好きな方を</p>



<h3 class="wp-block-heading">明示的に「Microsoft Scripting Runtime」のDictionaryとして宣言する</h3>



<p class="wp-block-paragraph">※※個人的にはコチラをおススメ※※</p>



<p class="wp-block-paragraph">「Dictionary」を「Scripting.Dictionary」に置換してあげればOK</p>



<p class="wp-block-paragraph">ちなみにVBA-JSONの中には別の箇所でも「Dictionary」の単語があってそこは置換すると別のエラーになるので「json_ParseObject」の型とそのソース内の1箇所だけを置換</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-lang="Visual Basic + VBA" data-line="1,5"><code>Private Function json_ParseObject(json_String As String, ByRef json_Index As Long) As Scripting.Dictionary
    Dim json_Key As String
    Dim json_NextChar As String

    Set json_ParseObject = New Scripting.Dictionary
    json_SkipSpaces json_String, json_Index
    If VBA.Mid$(json_String, json_Index, 1) &lt;&gt; &quot;{&quot; Then
        Err.Raise 10001, &quot;JSONConverter&quot;, json_ParseErrorMessage(json_String, json_Index, &quot;Expecting &#39;{&#39;&quot;)
    Else
        json_Index = json_Index + 1

        Do
            json_SkipSpaces json_String, json_Index
            If VBA.Mid$(json_String, json_Index, 1) = &quot;}&quot; Then
                json_Index = json_Index + 1
                Exit Function
            ElseIf VBA.Mid$(json_String, json_Index, 1) = &quot;,&quot; Then
                json_Index = json_Index + 1
                json_SkipSpaces json_String, json_Index
            End If

            json_Key = json_ParseKey(json_String, json_Index)
            json_NextChar = json_Peek(json_String, json_Index)
            If json_NextChar = &quot;[&quot; Or json_NextChar = &quot;{&quot; Then
                Set json_ParseObject.Item(json_Key) = json_ParseValue(json_String, json_Index)
            Else
                json_ParseObject.Item(json_Key) = json_ParseValue(json_String, json_Index)
            End If
        Loop
    End If
End Function</code></pre></div>



<h3 class="wp-block-heading">参照設定の優先順位を変える</h3>



<p class="wp-block-paragraph">半分原因の話にもなりますが「Dictionary」と宣言した時に「Microsoft Scripting Runtime」側になるように優先順位を変えるだけ</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_15.png"><img decoding="async" width="455" height="317" data-id="716" src="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_15.png" alt="" class="wp-image-716" srcset="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_15.png 455w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_15-300x209.png 300w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_15-150x105.png 150w" sizes="(max-width: 455px) 100vw, 455px" /></a><figcaption class="wp-element-caption">Selenium Type Libraryが優先されている</figcaption></figure>



<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_26.png"><img decoding="async" width="455" height="317" data-id="717" src="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_26.png" alt="" class="wp-image-717" srcset="https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_26.png 455w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_26-300x209.png 300w, https://javeo.jp/wp-content/uploads/2022/07/2022-07-16_22h38_26-150x105.png 150w" sizes="(max-width: 455px) 100vw, 455px" /></a><figcaption class="wp-element-caption">Selenium Type Libraryが優先されている</figcaption></figure>
</figure>



<h2 class="wp-block-heading">あとがき</h2>



<p class="wp-block-paragraph">APIとSeleniumBasicを使ったスクレイピングを併用したツールを作った時にこんな落とし穴があるとは知らず、解決するのに半日かかりました・・・</p>



<p class="wp-block-paragraph">同じエラーに嵌った人の助けになれば幸いでございます</p>
]]></content:encoded>
					
					<wfw:commentRss>https://javeo.jp/vba-json-error/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】Seleniumが利用できないと思っていたサイトでも利用できるようになった話</title>
		<link>https://javeo.jp/selenium-note1/</link>
					<comments>https://javeo.jp/selenium-note1/#respond</comments>
		
		<dc:creator><![CDATA[ジャベ雄]]></dc:creator>
		<pubDate>Sat, 02 Apr 2022 23:00:00 +0000</pubDate>
				<category><![CDATA[Excel・VBA]]></category>
		<category><![CDATA[SeleniumBasic]]></category>
		<guid isPermaLink="false">https://javeo.jp/?p=513</guid>

					<description><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2022/04/インターネット上で歓喜する人達のイラスト.png" class="webfeedsFeaturedVisual" /></p>まずAkamaiとは 本質的にはCDNなんですが、こいつが導入されてるとSeleniumの利用が制限されます（理由までは把握してませんのでなんで？とか聞かないで） 具体的な症状としてはログインページを開こうとした時ロード [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2022/04/インターネット上で歓喜する人達のイラスト.png" class="webfeedsFeaturedVisual" /></p><div class="codoc-evacuations" style="display:none;" data-shortcode=""></div>
<div class="wp-block-cocoon-blocks-info-box block-box primary-box">
<p class="wp-block-paragraph">Akamai導入サイトがわかりやすいのですがSeleniumでブラウザ操作しようとしてもできなかったサイトの対応方法がわかったので嬉しくて書いています</p>
</div>



<h2 class="wp-block-heading">まずAkamaiとは</h2>



<p class="wp-block-paragraph">本質的にはCDNなんですが、こいつが導入されてるとSeleniumの利用が制限されます（理由までは把握してませんのでなんで？とか聞かないで）</p>



<p class="wp-block-paragraph">具体的な症状としては<span class="marker-under">ログインページを開こうとした時ロードが終わらない</span>か、ログインページでID／PWを入力して<span class="marker-under">ログインボタンを押下するとロードが終わらない</span>のどちらかが大半</p>



<p class="wp-block-paragraph">で、Akamaiが導入されているかの確認はデベロッパーツールでソースを見れば簡単、Seleniumでサイトを開くと</p>



<p class="wp-block-paragraph">「&lt;script type=&#8221;text/javascript&#8221; src=&#8221;&lt;サイトドメイン&gt;/akam/**/********&#8221; defer=&#8221;&#8221;&gt;」</p>



<p class="wp-block-paragraph">ってソースが追加されてるので「akam」で検索すれば一発<br>※普通にChromeで開いてもこのソースは存在しません</p>



<figure class="wp-block-image size-full"><a href="https://javeo.jp/wp-content/uploads/2022/04/zozoのサンプル.png"><img decoding="async" width="573" height="300" src="https://javeo.jp/wp-content/uploads/2022/04/zozoのサンプル.png" alt="" class="wp-image-518" srcset="https://javeo.jp/wp-content/uploads/2022/04/zozoのサンプル.png 573w, https://javeo.jp/wp-content/uploads/2022/04/zozoのサンプル-300x157.png 300w, https://javeo.jp/wp-content/uploads/2022/04/zozoのサンプル-150x79.png 150w" sizes="(max-width: 573px) 100vw, 573px" /></a><figcaption class="wp-element-caption">ZOZOTOWNでakamaiが利用されているソース</figcaption></figure>



<h2 class="wp-block-heading">Seleniumが使えないサイト</h2>



<p class="wp-block-paragraph">全てAkamaiが導入されてるサイトってわけではなくて結果としてSeleniumが使えない＆これから書く方法で先に進めるサイトです<br>※気づいたら追加します</p>



<figure class="wp-block-table is-style-regular"><table><thead><tr><th>サイト</th><th>URL</th></tr></thead><tbody><tr><td>ZOZOTOWN</td><td><a href="https://zozo.jp/" target="_blank" rel="noreferrer noopener" title="">https://zozo.jp/</a></td></tr><tr><td>Peach（企業用？）</td><td><a href="https://travelagent.flypeach.com/" target="_blank" rel="noopener">https://travelagent.flypeach.com/</a></td></tr><tr><td>タオバオ</td><td><a href="https://login.taobao.com/" target="_blank" rel="noopener">https://login.taobao.com/</a></td></tr></tbody></table></figure>



<h2 class="wp-block-heading">利用できるようにするための方法</h2>



<p class="wp-block-paragraph">まずは具体的なソースを通常との比較で</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-file="一般的なソース" data-lang="Visual Basic + VBA" data-line="3"><code>Dim driver As Selenium.ChromeDriver
Set driver = New Selenium.ChromeDriver
driver.Start
driver.Get &quot;https://javeo.jp/&quot;</code></pre></div>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-file="変更ソース" data-lang="Visual Basic + VBA" data-line="3-4"><code>Dim driver As Selenium.ChromeDriver
Set driver = New Selenium.ChromeDriver
CreateObject(&quot;WScript.Shell&quot;).Run (&quot;chrome.exe --remote-debugging-port=9222)
driver.SetCapability &quot;debuggerAddress&quot;, &quot;127.0.0.1:9222&quot;
driver.Get &quot;https://javeo.jp/&quot;</code></pre></div>



<p class="wp-block-paragraph">一般的だと「start」にあたる部分を変更しています</p>



<p class="wp-block-paragraph">この起動方法に成功した時わかりやすい見た目の変化がありまして</p>



<ul class="wp-block-list">
<li>アドレスバーの下に「Chrome は自動テスト ソフトウェアによって制御されています。」が表示されない</li>



<li>アドレスバー横のアイコンが表示され日頃使っているプロファイルなのがわかる</li>
</ul>



<p class="wp-block-paragraph">※実際の比較は↓↓を参考に</p>



<figure class="wp-block-image size-large"><a href="https://javeo.jp/wp-content/uploads/2022/04/ChromeDriverの起動比較-1.gif"><img decoding="async" width="1024" height="576" src="https://javeo.jp/wp-content/uploads/2022/04/ChromeDriverの起動比較-1-1024x576.gif" alt="" class="wp-image-523" srcset="https://javeo.jp/wp-content/uploads/2022/04/ChromeDriverの起動比較-1-1024x576.gif 1024w, https://javeo.jp/wp-content/uploads/2022/04/ChromeDriverの起動比較-1-300x169.gif 300w, https://javeo.jp/wp-content/uploads/2022/04/ChromeDriverの起動比較-1-149x84.gif 149w, https://javeo.jp/wp-content/uploads/2022/04/ChromeDriverの起動比較-1-768x432.gif 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h2 class="wp-block-heading">この起動方法だと何が違うの？</h2>



<p class="wp-block-paragraph">普通にstartで起動した時だとnavigatorなどで検知できるので、Akamaiに限らず&#8221;こいつchromedriverでサイト開いてるぞ&#8221;ってのがバレてブロックされるケースがあります</p>



<p class="wp-block-paragraph">ですが、この起動だとChromeとして起動したことになるのでこの検知が効かずブラウザ操作ができるようになることがあるっぽいです（多分）</p>



<p class="wp-block-paragraph">起動後の操作はいつものSeleniumと同じで大丈夫なのでもしSeleniumが利用できないサイトにぶち当たった時は置き換えてみてください</p>



<h2 class="wp-block-heading">あとがき</h2>



<p class="wp-block-paragraph">スクレイピング自体を推奨するわけではなくてRPAツール代わりとしてSeleniumは無償なのに十分な効果を発揮できるので今回の発見は個人的にかなり嬉しくて</p>



<p class="wp-block-paragraph">お仕事あればお待ちしています</p>
]]></content:encoded>
					
					<wfw:commentRss>https://javeo.jp/selenium-note1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】VBAでWebを自動化！SeleniumBasicインストールから使い方まで解説</title>
		<link>https://javeo.jp/seleniumbasic-startup/</link>
					<comments>https://javeo.jp/seleniumbasic-startup/#respond</comments>
		
		<dc:creator><![CDATA[ジャベ雄]]></dc:creator>
		<pubDate>Sat, 19 Feb 2022 23:00:00 +0000</pubDate>
				<category><![CDATA[Excel・VBA]]></category>
		<category><![CDATA[ChromeDriver]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[SeleniumBasic]]></category>
		<category><![CDATA[自動化]]></category>
		<guid isPermaLink="false">https://javeo.jp/?p=62</guid>

					<description><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2026/06/seleniumbasic-startup-1-1024x538.jpg" class="webfeedsFeaturedVisual" /></p>SeleniumBasicのインストールからchromedriverの差し替え、.NET Framework3.5、Edge対応まで2026年版で解説、2016年に更新が止まった現状と後継のSeleniumVBAも踏まえて初心者向けにまとめました]]></description>
										<content:encoded><![CDATA[<p><img src="https://javeo.jp/wp-content/uploads/2026/06/seleniumbasic-startup-1-1024x538.jpg" class="webfeedsFeaturedVisual" /></p><div class="codoc-evacuations" style="display:none;" data-shortcode=""></div>
<div class="wp-block-group is-style-big_icon_point"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">「Webサイトから定期的に情報を取得したい」「Web上のフォームに毎回同じ内容を入力するのが面倒だ」——そんな定型作業を自動化できたら、と思ったことはありませんか？</p>



<p class="wp-block-paragraph">Excel VBAと「SeleniumBasic」を組み合わせることで、こうしたWebブラウザ上の操作を自動化できます</p>



<p class="wp-block-paragraph">この記事では、SeleniumBasicの導入から、実際にVBAでブラウザを操作する最初のステップまで解説します</p>
</div></div>



<p class="wp-block-paragraph">ひとつ頭に入れておいてほしいのが、SeleniumBasicは2016年を最後に更新が止まっている枯れたツールという点です、最新のChromeで動かすにはドライバーを手動で差し替える前提になり、無保証・自己責任で使うことになります</p>



<p class="wp-block-paragraph">同じVBA×Seleniumで後継の「SeleniumVBA」という選択肢もあります、ドライバーの自動更新や.NET Framework不要といった点で便利な一方で、SeleniumBasicはPythonなど他言語でSeleniumを使い慣れている人には<strong>APIの書き方が近くて馴染みやすい</strong>という強みもあります</p>



<p class="wp-block-paragraph">どちらが向いているかは状況次第なので、記事の最後に使い分けガイドをまとめました、まずはSeleniumBasicのインストールから動かすところまで順に見ていきます</p>



<h2 class="wp-block-heading" id="seleniumとは">まずSeleniumとSeleniumBasicとは</h2>



<p class="wp-block-paragraph">Seleniumは、Webブラウザの操作を自動化するためのフレームワーク、もともとはUIテスト用に開発されましたが、<strong>RPAやスクレイピングにも活用できます</strong></p>



<ul class="wp-block-list -list-under-dashed">
<li>対応言語:Python、Java、Ruby、VBAなど</li>



<li>対応ブラウザ:Chrome、Edge、Firefox</li>
</ul>



<p class="wp-block-paragraph">そしてSeleniumBasicは、そのSeleniumをVBAのクラスから利用できるようにするためのモジュールです</p>



<p class="wp-block-paragraph">オープンソースなので無料で利用でき、学習コストこそかかるものの、よくあるRPAツールのようなイニシャル/ランニングコストはかかりません</p>



<div class="wp-block-group is-style-big_icon_caution"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">ひとつ知っておいてほしいのが、SeleniumBasic本体は<strong><span class="swl-marker mark_yellow">2016年3月のバージョンが最後で、それ以降は更新が止まっている</span></strong>という点です</p>



<p class="wp-block-paragraph">古くからの定番ではありますが、後継のSeleniumVBAという選択肢もあります、深刻な脆弱性の報告が表立っているわけではないものの、無保証・自己責任で使う前提で、同梱されているドライバーは古いので各自で最新版を用意するのが基本になります</p>
</div></div>



<h2 class="wp-block-heading" id="インストール方法">SeleniumBasicのインストール手順</h2>



<p class="wp-block-paragraph">インストーラーを実行するだけの簡単な操作ですが、ふだんあまり使わないGithubからのダウンロードなので、キャプチャ付きで手順を追っていきます</p>



<h3 class="wp-block-heading" id="インストーラーのダウンロード">インストーラーのダウンロード</h3>



<p class="wp-block-paragraph">まずはGithubからSeleniumBasicのインストーラーをダウンロードします</p>



<p class="wp-block-paragraph"><a href="https://github.com/florentbr/SeleniumBasic/releases/tag/v2.0.9.0" target="_blank" rel="noopener noreferrer">https://github.com/florentbr/SeleniumBasic/releases/tag/v2.0.9.0</a></p>



<p class="wp-block-paragraph">最終更新が2016年3月と古いですが、配布自体は2026年の今も問題なくできます、長く広く使われてきたツールなので、まずはこのバージョンをダウンロードしてください</p>


<div class="wp-block-image is-style-shadow">
<figure class="aligncenter size-full"><a href="https://javeo.jp/wp-content/uploads/2022/02/image-5.png"><img decoding="async" width="1014" height="824" src="https://javeo.jp/wp-content/uploads/2022/02/image-5.png" alt="" class="wp-image-69" srcset="https://javeo.jp/wp-content/uploads/2022/02/image-5.png 1014w, https://javeo.jp/wp-content/uploads/2022/02/image-5-300x244.png 300w, https://javeo.jp/wp-content/uploads/2022/02/image-5-768x624.png 768w" sizes="(max-width: 1014px) 100vw, 1014px" /></a></figure>
</div>


<h3 class="wp-block-heading" id="インストーラーの実行">インストーラーの実行</h3>



<p class="wp-block-paragraph">SeleniumBasicに限らずどのアプリにも言えることですが、&#8221;<strong><span class="swl-marker mark_yellow">管理者としてインストール</span></strong>&#8220;(右クリックして&#8221;管理者として実行&#8221;を選択)するか、&#8221;<strong><span class="swl-marker mark_yellow">ユーザーとしてインストール</span></strong>&#8220;(普通にダブルクリック)するかで、インストール先フォルダが変わります</p>



<p class="wp-block-paragraph">利用するうえではどちらでも特に影響はなく、セキュリティ的にはなるべく権限を絞る方がいいので、迷っている場合は<strong>ユーザーとして実行する方がベター</strong>です</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_09h56_52.png"><img decoding="async" width="331" height="500" src="https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_09h56_52.png" alt="" class="wp-image-3619" srcset="https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_09h56_52.png 331w, https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_09h56_52-199x300.png 199w, https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_09h56_52-99x150.png 99w" sizes="(max-width: 331px) 100vw, 331px" /></a><figcaption class="wp-element-caption">右クリックから「管理者として実行」</figcaption></figure>



<p class="wp-block-paragraph">改めてここからインストール手順を順に進めていきます</p>



<div class="swell-block-step" data-num-style="circle">
<div class="swell-block-step__item"><div class="swell-block-step__number u-bg-main"><span class="__label">STEP</span></div><div class="swell-block-step__title u-fz-l">最初の画面でNext</div><div class="swell-block-step__body">
<p class="wp-block-paragraph">最初の画面は無心で「Next」をクリックします</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_11h31_58.png"><img decoding="async" width="499" height="387" src="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_11h31_58.png" alt="" class="wp-image-70" srcset="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_11h31_58.png 499w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_11h31_58-300x233.png 300w" sizes="(max-width: 499px) 100vw, 499px" /></a></figure>
</div></div>



<div class="swell-block-step__item"><div class="swell-block-step__number u-bg-main"><span class="__label">STEP</span></div><div class="swell-block-step__title u-fz-l">ライセンスに同意</div><div class="swell-block-step__body">
<p class="wp-block-paragraph">ライセンス契約が気になる人は一読しつつ、「I accept the agreement」を選択して「Next」をクリックします</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_11h33_09.png"><img decoding="async" width="499" height="387" src="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_11h33_09.png" alt="" class="wp-image-82" srcset="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_11h33_09.png 499w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_11h33_09-300x233.png 300w" sizes="(max-width: 499px) 100vw, 499px" /></a></figure>
</div></div>



<div class="swell-block-step__item"><div class="swell-block-step__number u-bg-main"><span class="__label">STEP</span></div><div class="swell-block-step__title u-fz-l">インストール対象を選択</div><div class="swell-block-step__body">
<p class="wp-block-paragraph">インストール対象の選択画面です</p>



<p class="wp-block-paragraph">今は使えないInternet ExplorerやPhantomJSのドライバーもありますが、インストールしただけで何か影響が出るわけでもないので、よくわからない人は初期値の&#8221;Full installation&#8221;でもいいし、無駄なものはインストールしたくない人は下のように選んでおけばOKです</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_13h40_50.png"><img decoding="async" width="499" height="387" src="https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_13h40_50.png" alt="" class="wp-image-3620" srcset="https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_13h40_50.png 499w, https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_13h40_50-300x233.png 300w, https://javeo.jp/wp-content/uploads/2022/02/2025-10-13_13h40_50-150x116.png 150w" sizes="(max-width: 499px) 100vw, 499px" /></a></figure>
</div></div>



<div class="swell-block-step__item"><div class="swell-block-step__number u-bg-main"><span class="__label">STEP</span></div><div class="swell-block-step__title u-fz-l">インストール先を確認</div><div class="swell-block-step__body">
<p class="wp-block-paragraph">最終確認画面です、ここにインストール先のフォルダが表示されているのでチェックしておきます</p>



<ul class="wp-block-list -list-under-dashed">
<li>管理者の場合・・・<strong>C:\Program Files\SeleniumBasic</strong></li>



<li>ユーザの場合・・・<strong>C:\Users\&lt;ユーザー名>\AppData\Local\SeleniumBasic</strong></li>
</ul>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h16_09-2.png"><img decoding="async" width="499" height="387" src="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h16_09-2.png" alt="" class="wp-image-88" srcset="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h16_09-2.png 499w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h16_09-2-300x233.png 300w" sizes="(max-width: 499px) 100vw, 499px" /></a></figure>
</div></div>



<div class="swell-block-step__item"><div class="swell-block-step__number u-bg-main"><span class="__label">STEP</span></div><div class="swell-block-step__title u-fz-l">インストール完了</div><div class="swell-block-step__body">
<p class="wp-block-paragraph">これで無事完了です</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h19_09.png"><img decoding="async" width="499" height="387" src="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h19_09.png" alt="" class="wp-image-89" srcset="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h19_09.png 499w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h19_09-300x233.png 300w" sizes="(max-width: 499px) 100vw, 499px" /></a></figure>
</div></div>
</div>



<h2 class="wp-block-heading" id="chromedriverの更新">chromedriverを最新版に差し替える</h2>



<p class="wp-block-paragraph">インストールした直後の状態でSeleniumを利用すると、VBAから怒られます</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h35_57.png"><img decoding="async" width="427" height="194" src="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h35_57.png" alt="" class="wp-image-90" srcset="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h35_57.png 427w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_14h35_57-300x136.png 300w" sizes="(max-width: 427px) 100vw, 427px" /></a></figure>



<p class="wp-block-paragraph">chromedriverには、ふだん使っているChromeのバージョンに合わせたドライバーが必要という特徴があります、SeleniumBasicに<strong><span class="swl-marker mark_yellow" style="color:#e8313b">同梱されているドライバーは2016年当時のもので古すぎる</span></strong>ため、まずバージョンが合わずに動きません</p>



<p class="wp-block-paragraph">というわけで、最新のChromeで動かすには<strong><span class="swl-marker mark_yellow">chromedriverの差し替えが前提</span></strong>になります、ここからその手順を紹介していきます</p>



<p class="wp-block-paragraph">※プログラムで自動更新もできるので、気になる方は<a href="#afterword">最下部</a>へ※</p>



<h3 class="wp-block-heading" id="chromeのバージョン確認">Chromeのバージョン確認</h3>



<p class="wp-block-paragraph">まず今使っているChromeのバージョンの調べ方は、「Chrome右上の︙ → ヘルプ → Google Chromeについて」の設定画面を開くと見られます、アドレスバーに<strong>chrome://settings/help</strong>と入れても同じ画面に飛べます</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h08_38.png"><img decoding="async" width="571" height="503" src="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h08_38.png" alt="" class="wp-image-94" srcset="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h08_38.png 571w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h08_38-300x264.png 300w" sizes="(max-width: 571px) 100vw, 571px" /></a></figure>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/image-12.png"><img decoding="async" width="1024" height="537" src="https://javeo.jp/wp-content/uploads/2022/02/image-12-1024x537.png" alt="" class="wp-image-3272" srcset="https://javeo.jp/wp-content/uploads/2022/02/image-12-1024x537.png 1024w, https://javeo.jp/wp-content/uploads/2022/02/image-12-300x157.png 300w, https://javeo.jp/wp-content/uploads/2022/02/image-12-150x79.png 150w, https://javeo.jp/wp-content/uploads/2022/02/image-12-768x403.png 768w, https://javeo.jp/wp-content/uploads/2022/02/image-12.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h3 class="wp-block-heading" id="chromedriverのバージョン確認">chromedriverのバージョン確認</h3>



<p class="wp-block-paragraph">続いてchromedriverのバージョンの調べ方は、インストールフォルダにある「<strong>chromedriver.exe</strong>」を実行すると、コンソール画面が立ち上がってバージョンが表示されます</p>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/image-13.png"><img decoding="async" width="1024" height="536" src="https://javeo.jp/wp-content/uploads/2022/02/image-13-1024x536.png" alt="" class="wp-image-3274" srcset="https://javeo.jp/wp-content/uploads/2022/02/image-13-1024x536.png 1024w, https://javeo.jp/wp-content/uploads/2022/02/image-13-300x157.png 300w, https://javeo.jp/wp-content/uploads/2022/02/image-13-150x79.png 150w, https://javeo.jp/wp-content/uploads/2022/02/image-13-768x402.png 768w, https://javeo.jp/wp-content/uploads/2022/02/image-13.png 1198w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p class="wp-block-paragraph">※Chromeは起動時に自動更新されていくのに対し、chromedriverは前述のとおり自動更新されないため、放っておくとバージョン不一致が発生することがあります</p>



<h3 class="wp-block-heading" id="chromedriverの差し替え">Chrome for Testingから差し替え</h3>



<p class="wp-block-paragraph">更新と言っても、実際は対象バージョンのchromedriverと入れ替えを行うだけです</p>



<p class="wp-block-paragraph">下のページから、今使っているChromeのバージョンに合わせたドライバーをダウンロードします、Stableの中になければ下部にBeta/Dev/Canaryのチャンネルもあるので、そこから合うものを探してください</p>



<p class="wp-block-paragraph"><a href="https://googlechromelabs.github.io/chrome-for-testing/#stable" target="_blank" rel="noopener noreferrer">https://googlechromelabs.github.io/chrome-for-testing/#stable</a></p>



<p class="wp-block-paragraph">chromedriverの行から、OSに合わせてURLを直接叩いてダウンロードします、64bitのWindowsなら<strong>win64</strong>を選べます(win32でも動作します)</p>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2025-08-14_20h34_42.png"><img decoding="async" width="1024" height="550" src="https://javeo.jp/wp-content/uploads/2022/02/2025-08-14_20h34_42-1024x550.png" alt="" class="wp-image-3273" srcset="https://javeo.jp/wp-content/uploads/2022/02/2025-08-14_20h34_42-1024x550.png 1024w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-14_20h34_42-300x161.png 300w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-14_20h34_42-150x81.png 150w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-14_20h34_42-768x413.png 768w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-14_20h34_42-1536x826.png 1536w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-14_20h34_42.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p class="wp-block-paragraph">ダウンロードしたzipを解凍すると「chromedriver.exe」が取り出せるので、SeleniumBasicをインストールしたフォルダにある古いドライバーを、これで上書き更新します</p>


<div class="wp-block-image is-style-shadow">
<figure class="aligncenter size-full"><a href="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h45_15.png"><img decoding="async" width="969" height="437" src="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h45_15.png" alt="" class="wp-image-99" srcset="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h45_15.png 969w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h45_15-300x135.png 300w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h45_15-768x346.png 768w" sizes="(max-width: 969px) 100vw, 969px" /></a></figure>
</div>


<div class="wp-block-group is-style-big_icon_caution"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">うまく起動しないときは、たいていバージョン不一致が原因です</p>



<p class="wp-block-paragraph"><strong>session not created</strong>や<strong>This version of ChromeDriver only supports Chrome version XXX</strong>といったエラーが出たら、Chromeのバージョンを確認して、それに一致するchromedriverをChrome for Testingから入手し、差し替えてあげればOKです</p>



<p class="wp-block-paragraph">なお構成によっては、実行ファイルの指定やユーザーデータフォルダの指定といった追加設定が必要になる場合もあります(2026年時点)、まずはバージョンを合わせるところから試してみてください</p>
</div></div>



<div class="swell-block-accordion">
<details class="swell-block-accordion__item" data-swl-acc="wrapper"><summary class="swell-block-accordion__title" data-swl-acc="header"><span class="swell-block-accordion__label">※Chrome 115より前は管理ページが違いました</span><span class="swell-block-accordion__icon c-switchIconBtn" data-swl-acc="icon" aria-hidden="true" data-opened="false"><i class="__icon--closed icon-caret-down"></i><i class="__icon--opened icon-caret-up"></i></span></summary><div class="swell-block-accordion__body" data-swl-acc="body">
<p class="wp-block-paragraph">Chrome 115より前のバージョンでは、下の旧管理ページからドライバーを配布していました</p>



<p class="wp-block-paragraph"><a href="https://sites.google.com/chromium.org/driver/downloads" target="_blank" rel="noopener noreferrer">https://sites.google.com/chromium.org/driver/downloads</a></p>


<div class="wp-block-image is-style-shadow">
<figure class="aligncenter size-large"><a href="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h04_15.png"><img decoding="async" width="1024" height="401" src="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h04_15-1024x401.png" alt="" class="wp-image-93" srcset="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h04_15-1024x401.png 1024w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h04_15-300x118.png 300w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h04_15-768x301.png 768w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h04_15.png 1077w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>
</div>


<p class="wp-block-paragraph">今はChrome 115以降が当たり前なので、基本はChrome for Testingを使えば大丈夫です、古いChromeのドライバーを探すときの参考までに残しておきます</p>


<div class="wp-block-image is-style-shadow">
<figure class="aligncenter size-full"><a href="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h40_43.png"><img decoding="async" width="816" height="310" src="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h40_43.png" alt="" class="wp-image-98" srcset="https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h40_43.png 816w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h40_43-300x114.png 300w, https://javeo.jp/wp-content/uploads/2022/02/2022-02-20_15h40_43-768x292.png 768w" sizes="(max-width: 816px) 100vw, 816px" /></a></figure>
</div></div></details>
</div>



<h2 class="wp-block-heading">.NET Framework 3.5 を用意する</h2>



<p class="wp-block-paragraph">VBAから<strong>CreateObject(&#8220;Selenium.ChromeDriver&#8221;)</strong>でインスタンスを作ろうとしたときに、.NET Framework 3.5がないとオートメーションエラーが発生する場合があるので、その対応をしておきます、これは2026年の今でも変わらず必要です</p>



<figure class="wp-block-image size-full is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_11h50_33.png"><img decoding="async" width="709" height="372" src="https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_11h50_33.png" alt="" class="wp-image-665" srcset="https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_11h50_33.png 709w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_11h50_33-300x157.png 300w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_11h50_33-150x79.png 150w" sizes="(max-width: 709px) 100vw, 709px" /></a></figure>



<p class="wp-block-paragraph">Windows 11での正攻法は、「Windowsの機能の有効化または無効化」を開いて<strong><span class="swl-marker mark_yellow">.NET Framework 3.5(.NET 2.0 および 3.0 を含む)</span></strong>にチェックを入れる方法です、スタートメニューで「Windowsの機能」と検索すると設定画面が開けます</p>



<div class="wp-block-group is-style-big_icon_memo"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">.NET Framework 3.5の入れ方は、お使いのWindows 11のバージョンで手順が分かれます</p>



<ul class="wp-block-list -list-under-dashed">
<li><strong>25H2以前</strong>・・・「Windowsの機能の有効化または無効化」やDISMコマンド(NetFx3)で入れられます</li>



<li><strong>26H1(build 28000)以降</strong>・・・専用のスタンドアロンインストーラーのみで、「機能の有効化」やDISMでは入れられません</li>
</ul>



<p class="wp-block-paragraph">26H1以降のWindows 11を使っている場合は、Microsoftが配布している.NET Framework 3.5のスタンドアロンインストーラーを使う形になります</p>
</div></div>



<p class="wp-block-paragraph">もう少し手早く済ませたい場合は、SeleniumBasicフォルダ内の<strong>Scriptsフォルダ</strong>にある「<strong>StartChrome.vbs</strong>」を実行する方法もあります、.NET Framework 3.5が入っていなければ、エラーメッセージとともにインストール画面が出てくるので、そのまま導入できます</p>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h03_32.png"><img decoding="async" width="1024" height="537" src="https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h03_32-1024x537.png" alt="" class="wp-image-666" srcset="https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h03_32-1024x537.png 1024w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h03_32-300x157.png 300w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h03_32-150x79.png 150w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h03_32-768x403.png 768w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h03_32.png 1201w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p class="wp-block-paragraph">すでに.NET Framework 3.5がインストールされている場合は、空のChromeが立ち上がってメッセージが出てきます</p>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h18_25.png"><img decoding="async" width="1024" height="539" src="https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h18_25-1024x539.png" alt="" class="wp-image-669" srcset="https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h18_25-1024x539.png 1024w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h18_25-300x158.png 300w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h18_25-150x79.png 150w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h18_25-768x404.png 768w, https://javeo.jp/wp-content/uploads/2022/05/2022-05-02_12h18_25.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<div class="wp-block-group is-style-big_icon_caution"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">このStartChrome.vbsから.NETを呼び出す方式(オンデマンドのインストール)は、<strong><span class="swl-marker mark_yellow">26H1以降のWindows 11では使えない</span></strong>ので、その場合は前述のスタンドアロンインストーラーで入れてください</p>
</div></div>



<p class="wp-block-paragraph">ちなみに<strong>StartChrome.vbs</strong>の中身はこれだけです</p>



<p class="wp-block-paragraph">「<strong>Set driver = CreateObject(&#8220;Selenium.ChromeDriver&#8221;)</strong>」で発生するエラーに反応して.NET Framework 3.5のインストールを促してくれるんだろうから「さすがMS」と思いつつ、「だったらVBAでもそうしてくれよ・・・」と不満を吐いてみます</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-vba" data-file="StartChrome.vbs" data-lang="Visual Basic + VBA"><code>Set driver = CreateObject(&quot;Selenium.ChromeDriver&quot;)
driver.Start
WScript.Echo &quot;Click OK to quit&quot;
driver.Quit</code></pre></div>



<p class="wp-block-paragraph">なお、Microsoftの正規ページから.NET Framework 3.5を入手する経路もありますが、Windows 11では上記の「Windowsの機能の有効化」が主役になるので、まずはそちらを試すのがおすすめです</p>



<h2 class="wp-block-heading">Edge(msedgedriver)を使う場合</h2>



<p class="wp-block-paragraph">ChromeだけでなくEdgeでも同じ話で、当然ながらドライバーの配布サイトが違うので、Edgeの場合はこちらから入手します</p>



<p class="wp-block-paragraph"><a href="https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver" target="_blank" rel="noopener noreferrer">https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver</a></p>



<p class="wp-block-paragraph">各チャネルの最新版はページ上部から中央に、過去版を含めたバージョン別のドライバーはその下の「Recent versions」から「Go to full directory」とたどると見つかります</p>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/image-14.png"><img decoding="async" width="1024" height="550" src="https://javeo.jp/wp-content/uploads/2022/02/image-14-1024x550.png" alt="" class="wp-image-3275" srcset="https://javeo.jp/wp-content/uploads/2022/02/image-14-1024x550.png 1024w, https://javeo.jp/wp-content/uploads/2022/02/image-14-300x161.png 300w, https://javeo.jp/wp-content/uploads/2022/02/image-14-150x81.png 150w, https://javeo.jp/wp-content/uploads/2022/02/image-14-768x413.png 768w, https://javeo.jp/wp-content/uploads/2022/02/image-14-1536x826.png 1536w, https://javeo.jp/wp-content/uploads/2022/02/image-14.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<figure class="wp-block-image size-large is-style-shadow"><a href="https://javeo.jp/wp-content/uploads/2022/02/2025-08-15_00h21_51.png"><img decoding="async" width="1024" height="550" src="https://javeo.jp/wp-content/uploads/2022/02/2025-08-15_00h21_51-1024x550.png" alt="" class="wp-image-3276" srcset="https://javeo.jp/wp-content/uploads/2022/02/2025-08-15_00h21_51-1024x550.png 1024w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-15_00h21_51-300x161.png 300w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-15_00h21_51-150x81.png 150w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-15_00h21_51-768x413.png 768w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-15_00h21_51-1536x826.png 1536w, https://javeo.jp/wp-content/uploads/2022/02/2025-08-15_00h21_51.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<div class="wp-block-group is-style-big_icon_point"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph">Edgeで気をつけたいのが、<strong><span class="swl-marker mark_yellow">Edge本体とmsedgedriverは、バージョン番号の先頭3つを一致させる必要がある</span></strong>という点です</p>



<p class="wp-block-paragraph">Edgeは自動更新で頻繁にバージョンが上がっていくので、ここがいちばんつまずきやすいところです、SeleniumBasic同梱のドライバーも古いので、Chromeのときと同じようにEdge用のドライバーも最新版へ差し替えてあげてください</p>



<p class="wp-block-paragraph">現行はChromium版Edgeが前提なので、レガシーEdge向けの古いドライバーは気にしなくて大丈夫です</p>
</div></div>



<h2 class="wp-block-heading" id="which-to-choose">SeleniumBasicとSeleniumVBAの使い分け</h2>



<p class="wp-block-paragraph">どちらも「VBAからSeleniumを使う」ための仕組みですが、向いている場面が違います</p>



<div class="wp-block-group is-style-big_icon_point"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph"><strong>SeleniumBasicが向いている場面</strong></p>



<ul class="wp-block-list -list-under-dashed">
<li>既存のSeleniumBasicコードを保守・引き継ぐ場合</li>



<li>Pythonなど他言語でSeleniumを使い慣れている場合(<code>driver.Get "URL"</code>などAPIの書き方が近い)</li>



<li>ネット上の解説記事や書籍が豊富な方がいい場合</li>
</ul>
</div></div>



<div class="wp-block-group is-style-big_icon_memo"><div class="wp-block-group__inner-container">
<p class="wp-block-paragraph"><strong>SeleniumVBAが向いている場面</strong></p>



<ul class="wp-block-list -list-under-dashed">
<li>ゼロから新規で始める場合</li>



<li>chromedriverの手動更新を省きたい場合(自動更新対応)</li>



<li>長期でメンテしていくプロジェクトで、継続開発中のツールを使いたい場合</li>
</ul>
</div></div>



<p class="wp-block-paragraph">SeleniumVBAに興味がある方は<a href="https://javeo.jp/selenium-vba/" target="_blank" rel="noopener noreferrer">SeleniumVBAの使い方</a>もあわせてどうぞ</p>



<h2 class="wp-block-heading" id="afterword">あとがき</h2>



<p class="wp-block-paragraph">VBAの場合は、ここまでやって利用準備が完了です</p>



<p class="wp-block-paragraph">ここまで読んでいただいて分かるとおり、chromedriverの差し替えは更新の頻度が高くてけっこう面倒なので、プログラムでチェックした方が吉です</p>



<p class="wp-block-paragraph">私が自作したプログラムを公開しているので、気になる方はこちらへどうぞ</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-excel-python wp-block-embed-excel-python"><div class="wp-block-embed__wrapper">
https://javeo.jp/vba-chromedriver-auto-update/
</div></figure>



<p class="wp-block-paragraph">chromedriverの手作業が面倒に感じた方は、上の使い分けガイドも参考に<a href="https://javeo.jp/selenium-vba/" target="_blank" rel="noopener noreferrer">SeleniumVBAへの乗り換え</a>も選択肢のひとつです</p>


<div class="p-blogParts post_content" data-partsID="4601">
<div class="jv-books" id="jv-books-vba" data-shelf="vba"><div class="jv-books-head"><span class="jv-books-title"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4da.png" alt="📚" class="wp-smiley" style="height: 1em; max-height: 1em;" /> VBAの独学に効く本</span><span class="jv-books-pr">PR</span></div><div class="jv-books-grid"><div class="jv-book-card"><a class="jv-book-cover" href="https://www.amazon.co.jp/dp/4839975728?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/5722/9784839975722_1_2.jpg?_ex=240x240" alt="Excel VBA塾【動画×本で学ぶ!】" width="120" height="170" loading="lazy"></a><div class="jv-book-info"><p class="jv-book-title">Excel VBA塾【動画×本で学ぶ!】</p><p class="jv-book-author">たてばやし淳</p><div class="jv-book-btns"><a class="jv-btn jv-btn-az" href="https://www.amazon.co.jp/dp/4839975728?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="amazon" data-book="4839975728">Amazonで見る</a><a class="jv-btn jv-btn-rk" href="https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16918602%2F&#038;m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16918602%2F" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="rakuten" data-book="4839975728">楽天で見る</a></div></div></div><div class="jv-book-card"><a class="jv-book-cover" href="https://www.amazon.co.jp/dp/4297108755?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/8755/9784297108755.jpg?_ex=240x240" alt="パーフェクトExcel VBA" width="120" height="170" loading="lazy"></a><div class="jv-book-info"><p class="jv-book-title">パーフェクトExcel VBA</p><p class="jv-book-author">高橋宣成</p><div class="jv-book-btns"><a class="jv-btn jv-btn-az" href="https://www.amazon.co.jp/dp/4297108755?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="amazon" data-book="4297108755">Amazonで見る</a><a class="jv-btn jv-btn-rk" href="https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16076590%2F&#038;m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16076590%2F" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="rakuten" data-book="4297108755">楽天で見る</a></div></div></div><div class="jv-book-card"><a class="jv-book-cover" href="https://www.amazon.co.jp/dp/4815631298?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/1291/9784815631291.jpg?_ex=240x240" alt="Excel マクロ&amp;VBA［実践ビジネス入門講座］完全版 第3版" width="120" height="170" loading="lazy"></a><div class="jv-book-info"><p class="jv-book-title">Excel マクロ&amp;VBA［実践ビジネス入門講座］完全版 第3版</p><p class="jv-book-author">国本温子</p><div class="jv-book-btns"><a class="jv-btn jv-btn-az" href="https://www.amazon.co.jp/dp/4815631298?tag=javeo2022-22" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="amazon" data-book="4815631298">Amazonで見る</a><a class="jv-btn jv-btn-rk" href="https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F18165619%2F&#038;m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F18165619%2F" target="_blank" rel="nofollow sponsored noopener noreferrer" data-shelf="vba" data-mall="rakuten" data-book="4815631298">楽天で見る</a></div></div></div></div><p class="jv-books-note">私のおすすめからランダムで3冊を表示しています</p></div>
<style>
.jv-books{border:1px solid #e0e0e0;border-radius:8px;padding:16px;margin:1.5em 0;background:#fff}
.jv-books-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.jv-books-title{font-weight:700;font-size:1.05em}
.jv-books-pr{font-size:.7em;color:#888;border:1px solid #ccc;border-radius:3px;padding:1px 6px;flex-shrink:0}
.jv-books-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;min-height:330px}
.jv-book-card{display:flex;flex-direction:column;align-items:center;text-align:center;border:1px solid #f0f0f0;border-radius:6px;padding:12px 8px;background:#fafafa}
.jv-book-cover img{width:auto;max-width:120px;height:170px;object-fit:contain}
.jv-book-info{width:100%;flex:1;display:flex;flex-direction:column}
.jv-book-title{font-size:.82em;font-weight:600;line-height:1.4;margin:8px 0 2px;min-height:2.8em;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.jv-book-author{font-size:.72em;color:#777;margin:0 0 8px}
.jv-book-btns{display:flex;flex-direction:column;gap:6px;width:100%;margin-top:auto}
.jv-btn{display:block;text-align:center;font-size:.78em;font-weight:600;color:#fff!important;text-decoration:none!important;border-radius:4px;padding:7px 4px;line-height:1.2}
.jv-btn-az{background:#e88b00}
.jv-btn-rk{background:#bf0000}
.jv-btn:hover{opacity:.85}
.jv-books-note{font-size:.7em;color:#999;text-align:right;margin:8px 0 0}
@media(max-width:599px){
.jv-books-grid{grid-template-columns:1fr;min-height:0}
.jv-book-card{flex-direction:row;text-align:left;gap:12px}
.jv-book-cover img{height:110px;max-width:80px}
.jv-book-info{min-width:0}
.jv-book-title{min-height:0}
.jv-book-btns{flex-direction:row}
.jv-btn{flex:1}
}
</style>
<script>
(function(){
var SHELF='vba';
var root=document.getElementById('jv-books-'+SHELF);
if(!root||root.dataset.init)return;
root.dataset.init='1';
var POOL=[{"t": "Excel VBA塾【動画×本で学ぶ!】", "a": "たてばやし淳", "img": "https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/5722/9784839975722_1_2.jpg?_ex=240x240", "az": "https://www.amazon.co.jp/dp/4839975728?tag=javeo2022-22", "rk": "https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16918602%2F&m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16918602%2F", "id": "4839975728"}, {"t": "パーフェクトExcel VBA", "a": "高橋宣成", "img": "https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/8755/9784297108755.jpg?_ex=240x240", "az": "https://www.amazon.co.jp/dp/4297108755?tag=javeo2022-22", "rk": "https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16076590%2F&m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F16076590%2F", "id": "4297108755"}, {"t": "Excel マクロ&VBA［実践ビジネス入門講座］完全版 第3版", "a": "国本温子", "img": "https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/1291/9784815631291.jpg?_ex=240x240", "az": "https://www.amazon.co.jp/dp/4815631298?tag=javeo2022-22", "rk": "https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F18165619%2F&m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F18165619%2F", "id": "4815631298"}, {"t": "増強改訂版 できる イラストで学ぶ 入社1年目からのExcel VBA", "a": "きたみあきこ", "img": "https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/8414/9784295018414.jpg?_ex=240x240", "az": "https://www.amazon.co.jp/dp/4295018414?tag=javeo2022-22", "rk": "https://hb.afl.rakuten.co.jp/hgc/24ecde15.e492bb61.24ecde16.6c9a125b/?pc=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F17725381%2F&m=https%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F17725381%2F", "id": "4295018414"}];
var REL='nofollow sponsored noopener noreferrer';
function el(tag,cls){var e=document.createElement(tag);if(cls)e.className=cls;return e;}
function btn(href,cls,label,mall,id){
var a=el('a','jv-btn '+cls);a.href=href;a.target='_blank';a.rel=REL;a.textContent=label;
a.setAttribute('data-shelf',SHELF);a.setAttribute('data-mall',mall);a.setAttribute('data-book',id);
return a;}
function card(b){
var d=el('div','jv-book-card');
var cover=el('a','jv-book-cover');cover.href=b.az;cover.target='_blank';cover.rel=REL;
var img=el('img');img.src=b.img;img.alt=b.t;img.width=120;img.height=170;img.loading='lazy';
cover.appendChild(img);
var info=el('div','jv-book-info');
var ttl=el('p','jv-book-title');ttl.textContent=b.t;
var au=el('p','jv-book-author');au.textContent=b.a;
var btns=el('div','jv-book-btns');
btns.appendChild(btn(b.az,'jv-btn-az','Amazonで見る','amazon',b.id));
if(b.rk){btns.appendChild(btn(b.rk,'jv-btn-rk','楽天で見る','rakuten',b.id));}
info.appendChild(ttl);info.appendChild(au);info.appendChild(btns);
d.appendChild(cover);d.appendChild(info);
return d;}
var pool=POOL.slice();
for(var i=pool.length-1;i>0;i--){var j=Math.floor(Math.random()*(i+1));var t=pool[i];pool[i]=pool[j];pool[j]=t;}
var grid=root.querySelector('.jv-books-grid');
grid.style.opacity='0';
while(grid.firstChild)grid.removeChild(grid.firstChild);
pool.slice(0,3).forEach(function(b){grid.appendChild(card(b));});
grid.style.transition='opacity .5s ease';
void grid.offsetWidth;
grid.style.opacity='1';
})();
</script>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://javeo.jp/seleniumbasic-startup/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
