LoginSignup
1
2

More than 3 years have passed since last update.

【Selenium】chromedriverの相対パスを指定するには?

Last updated at Posted at 2020-11-08

1. はまったこと

Seleniumのchromedriverを、pythonスクリプトファイルと同じディレクトリに配置していた。
chromedriverは、スクリプトファイルから見てカレントディレクトリにあるので、以下で動いていた。

driver = webdriver.Chrome()

ところが、ある日、Mac OSをアップデートしたところ、chromedriverが見つからない(パスを通せ)とエラーが吐かれた。

2. 解決策

対処作として、以下に修正したところ、無事に動いた。

driver = webdriver.Chrome(executable_path='./chromedriver')
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2