【Python】seleniumのエラー「Chrome version must be between xxx」の対処法

こんにちは、nishi_talk(@nishi_talk)です。
seleniumを使っていたら、「Chrome version must be between xxx」のエラーが。。。
たびたび遭遇したエラーなので対処法をご紹介します。




早速結論

こちらが私が遭遇したエラー文。

selenium.common.exceptions.WebDriverException: Message: session not created: Chrome version must be between 71 and 75
  (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.4.0-141-generic x86_64)

「Chormeのバージョンが違うよ!指定したバージョンにアップデートしてよ」ってことらしい。

バージョン確認

ますは現在のバージョンを確認。

$ google-chrome-stable -version
Google Chrome 70.0.3538.102

確認するとやっぱり指定されたバージョンじゃなかったので、アップデートする。

アップデート

アップデートします。

$ sudo apt install google-chrome-stable
Reading package lists... Done
Building dependency tree
Reading state information... Done
・
・
・
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up google-chrome-stable (72.0.3626.81-1) ...



バージョン確認

アップデートが終了したら再度バージョンを確認。

$ google-chrome-stable -version
Google Chrome 72.0.3626.81

これでOK!