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

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

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

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

スクレイピング

スクレイピングとは、公開されているWebサイトからページ内の情報を抽出する技術です。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

selenium

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

HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

Q&A

0回答

4749閲覧

selenium python SSLエラーが解消できない。

kumataro_

総合スコア5

Windows 10

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

スクレイピング

スクレイピングとは、公開されているWebサイトからページ内の情報を抽出する技術です。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

selenium

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

HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

0グッド

2クリップ

投稿2020/08/11 10:53

編集2020/08/12 03:40

selenium(python)でhtmlをダウンロードしたいのですが、以下のエラーが出ます。
[0811/194535.062:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101

ネット等で様々な情報を見たところ、driverに以下の設定をすればよいという記載が多かったのですが、設定しても解消されません。
options.add_argument('--ignore-certificate-errors')
options.add_argument('--ignore-ssl-errors')

詳しい方助言頂ければ助かります。

追記:
Python 3.7.4
ChromeDriver 84.0.4147.30
https://sites.google.com/a/chromium.org/chromedriver/home

追記2:
driver = webdriver.Chrome(executable_path=DRIVER_PATH, chrome_options=options)
の箇所を以下のように変更してもエラーは解消されません。
driver = webdriver.Chrome(executable_path=DRIVER_PATH, options=options)

python

1# coding:utf-8 2 3from selenium import webdriver 4from selenium.webdriver.chrome.options import Options 5from selenium.webdriver.support.select import Select 6from selenium.webdriver.common.by import By 7from selenium.webdriver.common.keys import Keys 8from selenium.webdriver.common.alert import Alert 9from selenium.webdriver.support.ui import WebDriverWait 10from selenium.webdriver.support import expected_conditions as EC 11from selenium.common.exceptions import TimeoutException 12import time 13 14options = Options() 15options.add_argument('--disable-gpu') 16options.add_argument('--disable-extensions') 17options.add_argument('--proxy-server="direct://"') 18options.add_argument('--proxy-bypass-list=*') 19options.add_argument('--start-maximized') 20options.add_argument('--ignore-certificate-errors') 21options.add_argument('--ignore-ssl-errors') 22options.add_argument('--headless') 23 24 25DRIVER_PATH = "C:/Users/xxxxxxxxx/Desktop/xxx/xxx/selenium/chromedriver.exe" 26driver = webdriver.Chrome(executable_path=DRIVER_PATH, chrome_options=options) 27 28url = 'https://news.yahoo.co.jp/' 29driver.get(url) 30 31time.sleep(5) 32text = driver.page_source 33 34with open('xxxx.html', 'w', encoding='utf-8', errors='ignore') as f: 35 print(text,file=f)

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

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

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

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

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

meg_

2020/08/11 12:32

エラーが発生しているのはどの行ですか?
kumataro_

2020/08/12 02:03 編集

処理自体は最後まで通っていますが、warningが出ており、 その箇所(test.py:26)はコードで言うと以下の箇所です。 driver = webdriver.Chrome(executable_path=DRIVER_PATH, chrome_options=options) 以下がメッセージ全量です。 test.py:26: DeprecationWarning: use options instead of chrome_options driver = webdriver.Chrome(executable_path=DRIVER_PATH, chrome_options=options) DevTools listening on ws://127.0.0.1:49416/devtools/browser/3130b724-44b5-40b1-863e-5fd6873d1605 [0812/105807.759:INFO:CONSOLE(0)] "A cookie associated with a cross-site resource at http://yahoo.co.jp/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.", source: https://news.yahoo.co.jp/ (0) [0812/105807.768:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/105807.795:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/105807.816:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/105807.840:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/105807.858:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/105807.884:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 よろしくお願いします。
meg_

2020/08/12 02:12

> DeprecationWarning: use options instead of chrome_options 上記が全てかと思いますが。 メッセージ通りchrome_optionsの代わりにoptionsを使用してみてはどうでしょうか?
kumataro_

2020/08/12 02:44

ありがとうございます。 該当箇所を以下のように変更したところ、warningは無くなったのですが、エラーメッセージは無くなりませんでした。 driver = webdriver.Chrome(executable_path=DRIVER_PATH, options=options) メッセージ全量 DevTools listening on ws://127.0.0.1:50128/devtools/browser/85460b1f-4cda-482f-bfe3-53b141c1f419 [0812/114115.203:INFO:CONSOLE(0)] "A cookie associated with a cross-site resource at http://yahoo.co.jp/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.", source: https://news.yahoo.co.jp/ (0) [0812/114115.221:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/114115.244:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/114115.270:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/114115.297:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/114115.331:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 [0812/114115.355:ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -101 何か他にお気づきの点ございましたらお願い致します。
meg_

2020/08/12 02:55

> 処理自体は最後まで通っていますが、warningが出ており、 とコメントありましたが、 > warningは無くなったのですが、エラーメッセージは無くなりませんでした。 とあり、エラーは最初からあったのですか? コードを変えたことで発生したのですか?? また、追加の情報は”質問に”追記しましょう。
kumataro_

2020/08/12 03:34

質問はエラー解消に関するもので、タイトルにも本文にも記載している通りです。 最初から特に状況の変化はございません。 よろしくお願いします。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問