私はPython 3とPhantomJSを使用しています。私は警告のテキストを取得したいが、私は私のプロジェクトをコンパイルするとき、私はエラーPhantomJS Pythonの警告
Traceback (most recent call last):
File "C:/Users/Dante/Documents/GitHub/ProjectHeisenberg/BioInfoRNA/Main.py", line 8, in <module>
class Main:
File "C:/Users/Dante/Documents/GitHub/ProjectHeisenberg/BioInfoRNA/Main.py", line 63, in Main
print(alert.text)
File "C:\Python3\lib\site-packages\selenium\webdriver\common\alert.py", line 65, in text
return self.driver.execute(Command.GET_ALERT_TEXT)["value"]
File "C:\Python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 233, in execute
self.error_handler.check_response(response)
File "C:\Python3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 165, in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: Invalid Command Method - {"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:50844","User-Agent":"Python-urllib/3.5"},"httpVersion":"1.1","method":"GET","url":"/alert_text","urlParsed":{"anchor":"","query":"","file":"alert_text","directory":"/","path":"/alert_text","relative":"/alert_text","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/alert_text","queryKey":{},"chunks":["alert_text"]},"urlOriginal":"/session/24c37130-3103-11e6-bf6e-074d3d3fe80d/alert_text"}
を持っており、これは私のコードの断片である:
alert = browser.switch_to_alert()
browser.switch_to_alert()
print(alert.text)
私はこの問題を解決するにはどうすればよいですか?
を使用しますか? – alecxe
@alecxeバージョン:2.1.1 – DanteVoronoi
'selenium'パッケージを最新バージョンにアップグレードするとどうでしょうか? 'pip3 install --upgrade selenium' – alecxe