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

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

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

Microsoft Edgeは、マイクロソフト社が開発する新しいWebブラウザです。Windows 10から標準搭載されており、Internet Explorerとは違うレンダリングエンジンが採用されています。

セッション

Sessionはクライアントがサーバに送ったすべてのリクエストのことを指します。

Python

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

selenium

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

Q&A

解決済

1回答

2456閲覧

Python Selenium egde セッションが作れない

yuchikawa

総合スコア0

Microsoft Edge

Microsoft Edgeは、マイクロソフト社が開発する新しいWebブラウザです。Windows 10から標準搭載されており、Internet Explorerとは違うレンダリングエンジンが採用されています。

セッション

Sessionはクライアントがサーバに送ったすべてのリクエストのことを指します。

Python

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

selenium

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

0グッド

0クリップ

投稿2021/04/10 05:15

編集2021/04/12 00:41

前提・実現したいこと

python seleniumを用いてedgeブラウザを自動操作したいです。
しかし、エラーが出てしまい、つまづいています。
※今までgooggleChrome問題なく動いていました。顧客の要件変更に伴い、egdeでの実装をtryしています。

OS:Mac
言語:Python 3.6
ブラウザ:Microsoft Edge(バージョン 89.0.774.75)

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

--------------------------------------------------------------------------- SessionNotCreatedException Traceback (most recent call last) <ipython-input-5-163928a0ade3> in <module> 4 5 url= "https://www.google.com/" ----> 6 driver = webdriver.Edge(executable_path='/Users/yuchikawa/Dropbox/My Mac (YuのMacBook Pro)/Documents/edgedriver_mac64/msedgedriver') 7 driver.get(url) 8 ~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/edge/webdriver.py in __init__(self, executable_path, capabilities, port, verbose, service_log_path, log_path, keep_alive) 64 resolve_ip=False, 65 keep_alive=keep_alive), ---> 66 desired_capabilities=capabilities) 67 self._is_remote = False 68 ~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options) 155 warnings.warn("Please use FirefoxOptions to set browser profile", 156 DeprecationWarning, stacklevel=2) --> 157 self.start_session(capabilities, browser_profile) 158 self._switch_to = SwitchTo(self) 159 self._mobile = Mobile(self) ~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, capabilities, browser_profile) 250 parameters = {"capabilities": w3c_caps, 251 "desiredCapabilities": capabilities} --> 252 response = self.execute(Command.NEW_SESSION, parameters) 253 if 'sessionId' not in response: 254 response = response['value'] ~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params) 319 response = self.command_executor.execute(driver_command, params) 320 if response: --> 321 self.error_handler.check_response(response) 322 response['value'] = self._unwrap_value( 323 response.get('value', None)) ~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response) 240 alert_text = value['alert'].get('text') 241 raise exception_class(message, screen, stacktrace, alert_text) --> 242 raise exception_class(message, screen, stacktrace) 243 244 def _value_or_default(self, obj, key, default): SessionNotCreatedException: Message: session not created: No matching capabilities found

該当のソースコード

※コメントアウトされている「Chrome」の方は問題なく動くことを確認済み

python

1from selenium import webdriver 2 3#driver = webdriver.Chrome(executable_path='/Users/yuchikawa/Dropbox/My Mac (YuのMacBook Pro)/Documents/scraping/chromedriver') 4driver = webdriver.Edge(executable_path='/Users/yuchikawa/Dropbox/My Mac (YuのMacBook Pro)/Documents/scraping/msedgedriver') 5 6

試したこと

・webdriverのバージョンとedgeバージョンの互換性確認
→問題なし

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

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

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

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

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

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

guest

回答1

0

自己解決

macOSでEdgeのドライバーを作成する際は、ケイパビリティを渡す必要があるとのことでした。
以下コードで解決しました。

Python3.6

1desired_cap={} 2 3driver = webdriver.Edge(executable_path='/Users/yuchikawa/Dropbox/My Mac (YuのMacBook Pro)/Documents/scraping/msedgedriver', capabilities=desired_cap)

※StackOverFlowにて別途回答をいただき、解決しました。
(参考)
https://stackoverflow.com/questions/67051558/edge-browser-driver-does-not-launch-in-selenium

投稿2021/04/16 00:58

yuchikawa

総合スコア0

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問