PythonでのSeleniumのChromedriverの件です。
昨日までサクサク動いていたプログラムが急に動かなくなったぞ?
えーと、 「selenium this version of chromedriver only supports~」
そうか、またChromeのバージョンアップか。 ということで、ドライバーをアップデートするわけですが、そのやり方については以前触れました。
でも、いい加減面倒になってくるんですね。 自動でやってくれないかなー、と。
そうしたら、同じように考える人はいるようです。 毎回プログラムの起動時に、対応しているChromedriverかどうかチェックしてくれて、対応していなかったらアップデートしておいてくれるライブラリがありました。
webdriver_manager
というものですが、普通にpipでインストールできます。
pip install webdriver-manager
あとは、ブラウザを立ち上げるプログラムを少し書き換えるだけです。
from webdriver_manager.chrome import ChromeDriverManager
を冒頭に追加して、
driver = webdriver.Chrome()
だったところを
driver = webdriver.Chrome(ChromeDriverManager().install())
に変えるだけです。 これで手動アップデートとはおさらば。 一つ難点があるとすれば、ブラウザが立ち上がるたびに、
[WDM] – Current google-chrome version is 89.0.4389 [WDM] – Get LATEST driver version for 89.0.4389 [WDM] – Driver [/Users/*****/drivers/chromedriver/mac64/89.0.4389.87/chromedriver] found in cache
といった表示がされるので、ちょっとウザいということくらいでしょうか。
Selenium本
Selenium with Python - A Beginner’s Guide Get started with Selenium using Python as a programming la
2,647円(税込)【送料込】
楽天Kobo電子書籍ストア
<p>Selenium is the most popular open source test automation tool available in the market. In the las
Test-Driven Development with Python Obey the Testing Goat: Using Django, Selenium, and JavaScript【電子
6,151円(税込)【送料込】
楽天Kobo電子書籍ストア
<p>The third edition of this trusted guide shows you how to apply test-driven development (TDD) to b
Hands-On Web Scraping with Python Perform advanced scraping operations using various Python librarie
4,304円(税込)【送料込】
楽天Kobo電子書籍ストア
<p><b>Collect and scrape different complexities of data from the modern Web using the latest tools,
Selenium自?化??完全指南:基于Python【電子書籍】[ ?卓 ]
2,305円(税込)【送料込】
楽天Kobo電子書籍ストア
<p>本?共有19章。第1〜10章介?Selenium IDE、Selenium WebDriver、Selenium Grid、Appium等工具的?用。第11〜16章介?自?化????的??及模式
洋書 Paperback, Test-Driven Development with Python: Obey the Testing Goat: Using Django, Selenium, an
15,948円(税込)【送料別】
Glomarket
*** We ship internationally, so do not use a package forwarding service. We cannot ship to a package