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

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

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

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

selenium

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

Q&A

2回答

1010閲覧

seleniumの初期設定を完了させたいです。

isataki

総合スコア4

Python

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

selenium

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

0グッド

0クリップ

投稿2019/08/27 13:46

前提・実現したいこと

PythonのSeleniumの初期設定(エラーなく,google chromeを自動で立ち上げるところまで)を完了させたいです。
補足情報の環境で試みていますが,エラーが発生してしまいます。
ご教授お願い致します。

発生している問題・エラーメッセージ

--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py in start(self) 75 stderr=self.log_file, ---> 76 stdin=PIPE) 77 except TypeError: 4 frames /usr/lib/python3.6/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) 728 errread, errwrite, --> 729 restore_signals, start_new_session) 730 except: /usr/lib/python3.6/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) 1363 err_msg += ': ' + repr(err_filename) -> 1364 raise child_exception_type(errno_num, err_msg, err_filename) 1365 raise child_exception_type(err_msg) FileNotFoundError: [Errno 2] No such file or directory: '/Users/takiguchiisamu/Desktop/chromedriver': '/Users/takiguchiisamu/Desktop/chromedriver' During handling of the above exception, another exception occurred: WebDriverException Traceback (most recent call last) <ipython-input-29-403dccedc8d3> in <module>() 1 from selenium import webdriver 2 from selenium.webdriver.common.keys import Keys as keys ----> 3 driver = webdriver.Chrome(executable_path="/Users/takiguchiisamu/Desktop/chromedriver") 4 driver.get("https://aiacademy.jp/") /usr/local/lib/python3.6/dist-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: /usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py in start(self) 81 raise WebDriverException( 82 "'%s' executable needs to be in PATH. %s" % ( ---> 83 os.path.basename(self.path), self.start_error_message) 84 ) 85 elif err.errno == errno.EACCES: WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

該当のソースコード

from selenium import webdriver from selenium.webdriver.common.keys import Keys as keys driver = webdriver.Chrome(executable_path="/Users/takiguchiisamu/Desktop/chromedriver") driver.get("https://aiacademy.jp/")

試したこと

ChromeDriverを補足情報記載の最新バージョンではなく,ChromeDriver 76.0.3809.126を使用してみましたが,やはり出来ませんでした。
また,Windows10でも同じことをしましたがだめでした。
また,pathの格納場所を色々移動させたりしてみましたがだめでした。

補足情報(FW/ツールのバージョンなど)

使用ツール等
・mac
・google Colaboratory
・Google Chrome
バージョン: 76.0.3809.132(Official Build) (64 ビット)
・ChromeDriver 77.0.3865.40

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

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

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

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

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

meg_

2019/08/27 14:39

windows8では下記で使ってます。 driver = webdriver.Chrome("C:\\Users\\Downloads\\chromedriver.exe")
barobaro

2019/08/28 01:23

ChromeDriverとchromeのバージョンを一緒にしてないからではないですか?
guest

回答2

0

下記を確認いただくと参考になるかと思います。

インストールが必要なもの

homebrewを下記よりインストール
https://brew.sh/index_ja.html
pip install selenium
pip install chromedriver-binary

Chromeドライバーのインストール

brew tap homebrew/cask
brew cask install chromedriver

Chromeドライバーのダウンロード

https://chromedriver.chromium.org/downloads

投稿2019/12/04 20:15

john_doe_

総合スコア354

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

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

0

初心者なので間違っているかもしれませんが、
chrome 用のバイナリーがインストールされていないのではないでしょうか。

Python + Selenium で Chrome の自動操作を一通り(@memakura さん)
のchrome driver のインストールなどを参考にされてはいかがでしょう。

私はcolabratry環境なのでColaboratoryでSeleniumが使えた:javascriptで生成されるページも簡単スクレイピング(@ftoyoda さん)から以下のように写経させていただいてます。

python

1!pip install selenium 2!apt install chromium-chromedriver 3!cp /usr/lib/chromium-browser/chromedriver /usr/bin

投稿2019/08/28 01:08

編集2019/08/28 01:15
e_nasu

総合スコア11

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問