質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Jupyter

Jupyter (旧IPython notebook)は、Notebook形式でドキュメント作成し、プログラムの記述・実行、その実行結果を記録するツールです。メモの作成や保存、共有、確認などもブラウザ上で行うことができます。

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

selenium

Selenium(セレニウム)は、ブラウザをプログラムで作動させるフレームワークです。この原理を使うことにより、ブラウザのユーザーテストなどを自動化にすることができます。

Q&A

解決済

2回答

2185閲覧

Seleniumでエラー発生[動作環境: M1mac・Jupyter note・Anaconda]

Shion_1345

総合スコア3

Jupyter

Jupyter (旧IPython notebook)は、Notebook形式でドキュメント作成し、プログラムの記述・実行、その実行結果を記録するツールです。メモの作成や保存、共有、確認などもブラウザ上で行うことができます。

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

selenium

Selenium(セレニウム)は、ブラウザをプログラムで作動させるフレームワークです。この原理を使うことにより、ブラウザのユーザーテストなどを自動化にすることができます。

0グッド

0クリップ

投稿2021/08/30 08:19

編集2021/08/30 08:30

状況

Python3を使ってSeleniumを利用したいのですがYouTubeのチュートリアルどうりに進めたのですがどうしてもエラーが出てしまいます。
イメージ説明
<エラーコード>

FileNotFoundError Traceback (most recent call last) ~/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/common/service.py in start(self) 71 cmd.extend(self.command_line_args()) ---> 72 self.process = subprocess.Popen(cmd, env=self.env, 73 close_fds=platform.system() != 'Windows', ~/opt/anaconda3/lib/python3.8/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text) 857 --> 858 self._execute_child(args, executable, preexec_fn, close_fds, 859 pass_fds, cwd, env, ~/opt/anaconda3/lib/python3.8/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session) 1705 err_msg = os.strerror(errno_num) -> 1706 raise child_exception_type(errno_num, err_msg, err_filename) 1707 raise child_exception_type(err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver' During handling of the above exception, another exception occurred: WebDriverException Traceback (most recent call last) <ipython-input-23-78b07196e7cd> in <module> ----> 1 browser = webdriver.Chrome() ~/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive) 71 service_args=service_args, 72 log_path=service_log_path) ---> 73 self.service.start() 74 75 try: ~/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/common/service.py in start(self) 79 except OSError as err: 80 if err.errno == errno.ENOENT: ---> 81 raise WebDriverException( 82 "'%s' executable needs to be in PATH. %s" % ( 83 os.path.basename(self.path), self.start_error_message) WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

試したこと

Selenium,Chromedriverの再インストール

動作環境

  • M1 MacBook Pro
  • Google Chromeバージョン: 92.0.4515.159(Official Build) (arm64)

その他

参考にしていた動画
https://youtu.be/f8FXUUQ4uRA
イメージ説明

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver'

ファイルが見つからない、といってます。
そいつはどこにあるんでしょうか

投稿2021/08/30 08:24

y_waiwai

総合スコア87774

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Shion_1345

2021/08/30 08:28

macのダウンロードフォルダにあります。
y_waiwai

2021/08/30 08:32

なら、そのファイルをフルパスで指定してみては
Shion_1345

2021/08/30 08:40 編集

どやってどこに指定すれば良いですか? 度々すみません。
guest

0

ベストアンサー

Message: 'chromedriver' executable needs to be in PATH.

のメッセージの通りですが、おそらくPATHという概念が理解できていないのでしょうから、別の方法をとります。
chromedriverの場所(絶対パス)をプログラムに書きましょう。

質問文にプログラムが書いてないのであれですが、普通は、

Python

1driver = webdriver.Chrome()

のような箇所があると思うので、そこを、

Python

1driver = webdriver.Chrome(executable_path="chromedriverの絶対パス")

のようにします。絶対パスというのは分かりますか?

投稿2021/08/30 08:42

otn

総合スコア84555

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Shion_1345

2021/08/30 08:45

今、調べて絶対パスについてなんとなくわかりました。
Shion_1345

2021/08/30 08:48

driver = webdriver.Chrome(executable_path="chromedriverの絶対パス") でエラーなく実行できました。 ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問