1

Seleniumを使用してOperaブラウザでURLを開こうとしています。ここからoperadriver 0.2.2をダウンロードしましたhttps://github.com/operasoftware/operachromiumdriver/releases

これがpythonコードですopera.py

#! coding: utf:8
from selenium import webdriver
driver = webdriver.Opera()
driver.get('example.com')
driver.close()

しかし、それは私にエラーを与えます:

$ python opera.py
Traceback (most recent call last):
  File "opera.py", line 25, in <module>
    driver = webdriver.Opera()
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/opera/webdriver.py", line 73, in __init__
    service_log_path=service_log_path)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/opera/webdriver.py", line 52, in __init__
    service_log_path=service_log_path)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"2168.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: Opera with embedded Chromium 54.0.2840.99)
  (Driver info: OperaDriver=0.2.0 (ba47709ed9e35ce26dbd960fb5d75be104290d96),platform=Mac OS X 10.12.0 x86_64)

webdriver.Chrome()insted の Operaを使用すると、すべてが機能します。

この問題をどのように解決できwebdriver.Opera()ますか?

4

0 に答える 0