2017-09-01 9 views
0

Safariブラウザでテストケースを実行するには、macでPythonを使用していて、問題に直面しています。SafariブラウザでPythonを使用してセレンをセットアップする

sudo easy_install seleniumプリントはターミナルで次のコマンド:3.5.0であるセレン3.5.0 処理セレン-3.5.0-py2.7.egg セレン:セレン ベストマッチの検索

すでにセレン

0のためのセレン 完成処理の依存関係を/Library/Python/2.7/site-packages/selenium-3.5.0-py2.7.egg 処理の依存関係を使用して簡単install.pth

でアクティブなバージョン

トレースバック(最新:

from selenium import webdriver 
from selenium.webdriver.common.keys import Keys 
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities 
driver = webdriver.Safari() 
driver.get("https://www.google.co.in") 

それは、端末でこのエラーを示しています。私は、ウェブサイトを開くために、簡単なPythonスクリプトを実行したいとき

は今、私はこのコードを使用します最後の呼び出し): ファイル "a.py"、行5、 のドライバ= webdriver.Safari() ファイル "/Library/Python/2.7/site-packages/selenium-3.5.0-py2.7.egg/ selenium/webdriver/safari/webdriver.py "、52行目、i desired_capabilities = desired_capabilities) ファイル "/Library/Python/2.7/site-packages/selenium-3.5.0-py2.7.egg/selenium/webdriver/remote/webdriver.py"、行140、init self.start_session(desired_capabilities、browser_profile) ファイル "/Library/Python/2.7/site-packages/selenium-3.5.0-py2.7.egg/selenium/webdriver/remote/webdriver.py"、229行目、 in start_session レスポンス= self.execute(Command.NEW_SESSION、parameters) ファイル "/Library/Python/2.7/site-packages/selenium-3.5.0-py2.7.egg/selenium/webdriver/remote/webdriver.py "、行297、実行中 self.error_handler.check_response(応答) ファイル" /Library/Python/2.7/site-packages/selenium-3。 (message、screen、stacktrace) selenium.common.exceptions.WebDriverException:メッセージ:セッションを作成できませんでした。 Safariの[開発]メニューで[リモートオートメーションを許可]オプションを有効にして、WebDriver経由でSafariを制御する必要があります。

正確な問題は見つかりません。

ご協力いただきありがとうございます。

+1

については、以下の記事を参照してください、あなたのMacで「リモートオートメーションを許可する」オプションを有効にしましたか? – Dekel

+0

はい私はそれを有効にしました。 –

+0

フォーマット済みのコードとエラーを引用符で囲みます –

答えて

0

開き、SafariとでAllow Remote Execution

Enable Remote Automation

ためのオプションをチェックしても、それは許可し、それを与えることを可能するために要求した場合、端末内に一度safaridriver -p 5555を実行するメニューを開発。これは一度必要です。詳細

https://webkit.org/blog/6900/webdriver-support-in-safari-10/

関連する問題