enium.common.exceptions.WebDriverException: Message: unknown error: Runtime.executionContextCreated has invalid ‘context’
treace 如下:
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "D:\soft\python\lib\site-packages\_pytest\main.py", line 191, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "D:\soft\python\lib\site-packages\_pytest\main.py", line 235, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\manager.py", line 87, in
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "D:\soft\python\lib\site-packages\_pytest\main.py", line 256, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\manager.py", line 87, in
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "d:\soft\python\lib\site-packages\pytest_rerunfailures.py", line 176, in pytest_runtest_protocol
INTERNALERROR> reports = runtestprotocol(item, nextitem=nextitem, log=False)
INTERNALERROR> File "D:\soft\python\lib\site-packages\_pytest\runner.py", line 89, in runtestprotocol
INTERNALERROR> rep = call_and_report(item, "setup", log)
INTERNALERROR> File "D:\soft\python\lib\site-packages\_pytest\runner.py", line 178, in call_and_report
INTERNALERROR> report = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\manager.py", line 87, in
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "D:\soft\python\lib\site-packages\pluggy\callers.py", line 203, in _multicall
INTERNALERROR> gen.send(outcome)
INTERNALERROR> File "D:\code\pyautoTest-master\pyautoTest-master\conftest.py", line 82, in pytest_runtest_makereport
INTERNALERROR> capture_screenshot(case_name)
INTERNALERROR> File "D:\code\pyautoTest-master\pyautoTest-master\conftest.py", line 131, in capture_screenshot
INTERNALERROR> driver.save_screenshot(image_dir)
INTERNALERROR> File "D:\soft\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1055, in save_screenshot
INTERNALERROR> return self.get_screenshot_as_file(filename)
INTERNALERROR> File "D:\soft\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1032, in get_screenshot_as_file
INTERNALERROR> png = self.get_screenshot_as_png()
INTERNALERROR> File "D:\soft\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1064, in get_screenshot_as_png
INTERNALERROR> return base64.b64decode(self.get_screenshot_as_base64().encode('ascii'))
INTERNALERROR> File "D:\soft\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1074, in get_screenshot_as_base64
INTERNALERROR> return self.execute(Command.SCREENSHOT)['value']
INTERNALERROR> File "D:\soft\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
INTERNALERROR> self.error_handler.check_response(response)
INTERNALERROR> File "D:\soft\python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
INTERNALERROR> raise exception_class(message, screen, stacktrace)
INTERNALERROR> selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"91F9753F143A41F00BDD1D50ABDEFB51","isDefault":true,"type":"default"},"id":1,"name":"","origin":"://"}
INTERNALERROR> (Session info: chrome=79.0.3945.130)
INTERNALERROR> (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64)
很纳闷,前几天就能用,今天运行就报错,排查了好久才知道是驱动与浏览器的版本不一致,因为本人的浏览器设置了自动升级,所以导致了这个问题