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を制御する必要があります。
正確な問題は見つかりません。
ご協力いただきありがとうございます。
については、以下の記事を参照してください、あなたのMacで「リモートオートメーションを許可する」オプションを有効にしましたか? – Dekel
はい私はそれを有効にしました。 –
フォーマット済みのコードとエラーを引用符で囲みます –