selenium的webdriver.Opera()给出错误:session未从未知错误创建异常:Runtime.executionContextCreated具有无效的'context'

时间:2016-12-09 10:39:03

标签: python selenium selenium-webdriver opera operadriver

我正在尝试使用selenium在Opera浏览器中打开url。 我从这里https://github.com/operasoftware/operachromiumdriver/releases

下载了operadriver 0.2.2

这是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)

当我使用Opera的webdriver.Chrome()时,一切正常。

我如何使用webdriver.Opera()解决此问题?

0 个答案:

没有答案