Chrome 浏览器,unknown software exception,0x80000003

    不知道是什么原因,在保存书签的时候出现了这个错误。不一会浏览器都不能启动,一打开就弹出这个错误,Chrome崩溃。

    搜了一下,网上有说系统文件丢失了,下个驱动精灵。有的说用360安全卫士查杀一下木马。我倒是用360试了一下,还是没用。驱动精灵没用过。

    然后我重装了Chrome浏览器,没用。

    今天,我再试了一下。先把Chrome卸载,再重新装上,结果就没问题了。


运行上述代码出现如下报错: Traceback (most recent call last): File "G:\PythonProject\sel\screenshot.py", line 28, in <module> capture_screenshot('https://www.bilibili.com', 'screenshot.png') File "G:\PythonProject\sel\screenshot.py", line 14, in capture_screenshot driver = webdriver.Chrome( File "G:\PythonProject\.venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "G:\PythonProject\.venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 66, in __init__ super().__init__(command_executor=executor, options=options) File "G:\PythonProject\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 250, in __init__ self.start_session(capabilities) File "G:\PythonProject\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 342, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] File "G:\PythonProject\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute self.error_handler.check_response(response) File "G:\PythonProject\.venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary Stacktrace: Backtrace: GetHandleVerifier [0x00C7A813+48355] (No symbol) [0x00C0C4B1] (No symbol) [0x00B15358] (No symbol) [0x00B31A9E] (No symbol) [0x00B30579] (No symbol) [0x00B60C55] (No symbol) [0x00B6093C] (No symbol) [0x00B5A536] (No symbol) [0x00B382DC] (No symbol) [0x00B393DD] GetHandleVerifier [0x00EDAABD+2539405] GetHandleVerifier [0x00F1A78F+2800735] GetHandleVerifier [0x00F1456C+2775612] GetHandleVerifier [0x00D051E0+616112] (No symbol) [0x00C15F8C] (No symbol) [0x00C12328] (No symbol) [0x00C1240B] (No symbol) [0x00C04FF7] BaseThreadInitThunk [0x76765D49+25] RtlInitializeExceptionChain [0x779ACDEB+
03-22
['https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=0', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=30', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60', 'https://www.maoyan.com/films?showType=3&offset=60'] 详情链接:https://www.maoyan.com/films?showType=3&offset=0 Traceback (most recent call last): File "D:\大数据课程设计\SuperMovie\spiders\spiderMovies.py", line 128, in <module> spider_out(detail) File "D:\大数据课程设计\SuperMovie\spiders\spiderMovies.py", line 42, in spider_out browser = startBrowser() ^^^^^^^^^^^^^^ File "D:\大数据课程设计\SuperMovie\spiders\spiderMovies.py", line 24, in startBrowser browser = webdriver.Chrome(service=service,options=option) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\21825\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\chrome\webdriver.py", line 47, in __init__ super().__init__( File "C:\Users\21825\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\chromium\webdriver.py", line 69, in __init__ super().__init__(command_executor=executor, options=options) File "C:\Users\21825\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\remote\webdriver.py", line 257, in __init__ self.start_session(capabilities) File "C:\Users\21825\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\remote\webdriver.py", line 356, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\21825\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\remote\webdriver.py", line 447, in execute self.error_handler.check_response(response) File "C:\Users\21825\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: cannot connect to chrome at localhost:9223 from unknown error: unrecognized Chrome version: Edg/137.0.3296.93 Stacktrace: GetHandleVerifier [0x0x7ff6def1cda5+78885] GetHandleVerifier [0x0x7ff6def1ce00+78976] (No symbol) [0x0x7ff6decd9bca] (No symbol) [0x0x7ff6decabdc0] (No symbol) [0x0x7ff6decac467] (No symbol) [0x0x7ff6decac2d9] (No symbol) [0x0x7ff6decca822] (No symbol) [0x0x7ff6ded1d252] (No symbol) [0x0x7ff6ded1246e] (No symbol) [0x0x7ff6ded669ee] (No symbol) [0x0x7ff6ded66180] (No symbol) [0x0x7ff6ded58963] (No symbol) [0x0x7ff6ded216b1] (No symbol) [0x0x7ff6ded22443] GetHandleVerifier [0x0x7ff6df1f4eed+3061101] GetHandleVerifier [0x0x7ff6df1ef33d+3037629] GetHandleVerifier [0x0x7ff6df20e592+3165202] GetHandleVerifier [0x0x7ff6def3730e+186766] GetHandleVerifier [0x0x7ff6def3eb3f+217535] GetHandleVerifier [0x0x7ff6def259b4+114740] GetHandleVerifier [0x0x7ff6def25b69+115177] GetHandleVerifier [0x0x7ff6def0c368+10728] BaseThreadInitThunk [0x0x7fff71b7e8d7+23] RtlUserThreadStart [0x0x7fff7327c34c+44]
06-25
PS C:\Users\Administrator\Desktop\web8> & D:/Python/python.exe c:/Users/Administrator/Desktop/web8/CMG_024_test.py CMG_024_test.py::Test_CMG024::test_add_qvlan ------------------------------------------------------------------------------------ live log setup ------------------------------------------------------------------------------------- 17:20:16 - MyBaseTest - INFO - url:::http://192.168.11.110:5066/api/TestReport/create-report 17:20:16 - MyBaseTest - INFO - Report Create successfully. Report ID: 317 17:20:18 - MyBaseTest - INFO - Base Proxy address:localhost:8081 DevTools listening on ws://127.0.0.1:58322/devtools/browser/265bb708-e8e6-4d4b-9376-b87f130d5136 [26244:19408:0809/172019.494:ERROR:sandbox_win.cc(840)] Sandbox cannot access executable. Check filesystem permissions are valid. See https://bit.ly/31yqMJR.: 鎷掔粷璁块棶銆?(0x5) [26244:22000:0809/172019.591:ERROR:network_service_instance_impl.cc(600)] Network service crashed, restarting service. 17:20:34 - MyBaseTest - ERROR - Sign in Error ERROR [ 33%] CMG_024_test.py::Test_CMG024::test_add_qvlan_port[1234] ERROR [ 66%] CMG_024_test.py::Test_CMG024::test_qvlan_boundary ERROR [100%] ======================================================================================== ERRORS ========================================================================================= _____________________________________________________________________ ERROR at setup of Test_CMG024.test_add_qvlan ______________________________________________________________________ self = <MyBaseTest.BaseTest object at 0x000002680CCA0AD0> def sign_in(self): """执行登录操作(中文版)""" try: self.driver.get(self.dev_ip) time.sleep(3.5) > WebDriverWait(self.driver, 5).until( EC.visibility_of_element_located((By.ID, "password")) ) MyBaseTest.py:303: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ D:\Python\Lib\site-packages\selenium\webdriver\support\wait.py:129: in until value = method(self._driver) ^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\support\expected_conditions.py:217: in _predicate return _element_if_visible(driver.find_element(*locator)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:922: in find_element return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:454: in execute self.error_handler.check_response(response) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x000002680CCA12B0> response = {'status': 404, 'value': '{"value":{"error":"no such window","message":"no such window: target window already closed\\...07FF74CAEA3EF]\\n\\tBaseThreadInitThunk [0x00007FFAFC6FE8D7+23]\\n\\tRtlUserThreadStart [0x00007FFAFD7BC34C+44]\\n"}}'} def check_response(self, response: dict[str, Any]) -> None: """Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object. :Raises: If the response contains an error message. """ status = response.get("status", None) if not status or status == ErrorCode.SUCCESS: return value = None message = response.get("message", "") screen: str = response.get("screen", "") stacktrace = None if isinstance(status, int): value_json = response.get("value", None) if value_json and isinstance(value_json, str): try: value = json.loads(value_json) if isinstance(value, dict): if len(value) == 1: value = value["value"] status = value.get("error", None) if not status: status = value.get("status", ErrorCode.UNKNOWN_ERROR) message = value.get("value") or value.get("message") if not isinstance(message, str): value = message message = message.get("message") else: message = value.get("message", None) except ValueError: pass exception_class: type[WebDriverException] e = ErrorCode() error_codes = [item for item in dir(e) if not item.startswith("__")] for error_code in error_codes: error_info = getattr(ErrorCode, error_code) if isinstance(error_info, list) and status in error_info: exception_class = getattr(ExceptionMapping, error_code, WebDriverException) break else: exception_class = WebDriverException if not value: value = response["value"] if isinstance(value, str): raise exception_class(value) if message == "" and "message" in value: message = value["message"] screen = None # type: ignore[assignment] if "screen" in value: screen = value["screen"] stacktrace = None st_value = value.get("stackTrace") or value.get("stacktrace") if st_value: if isinstance(st_value, str): stacktrace = st_value.split("\n") else: stacktrace = [] try: for frame in st_value: line = frame.get("lineNumber", "") file = frame.get("fileName", "<anonymous>") if line: file = f"{file}:{line}" meth = frame.get("methodName", "<anonymous>") if "className" in frame: meth = f"{frame['className']}.{meth}" msg = " at %s (%s)" msg = msg % (meth, file) stacktrace.append(msg) except TypeError: pass if exception_class == UnexpectedAlertPresentException: alert_text = None if "data" in value: alert_text = value["data"].get("text") elif "alert" in value: alert_text = value["alert"].get("text") raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here > raise exception_class(message, screen, stacktrace) E selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed E from unknown error: web view not found E (Session info: chrome=127.0.6533.99) E Stacktrace: E GetHandleVerifier [0x00007FF74CB39632+30946] E (No symbol) [0x00007FF74CAEE3C9] E (No symbol) [0x00007FF74C9E6FDA] E (No symbol) [0x00007FF74C9BCB85] E (No symbol) [0x00007FF74CA637A7] E (No symbol) [0x00007FF74CA7A771] E (No symbol) [0x00007FF74CA5C813] E (No symbol) [0x00007FF74CA2A6E5] E (No symbol) [0x00007FF74CA2B021] E GetHandleVerifier [0x00007FF74CC6F83D+1301229] E GetHandleVerifier [0x00007FF74CC7BDB7+1351783] E GetHandleVerifier [0x00007FF74CC72A03+1313971] E GetHandleVerifier [0x00007FF74CB6DD06+245686] E (No symbol) [0x00007FF74CAF758F] E (No symbol) [0x00007FF74CAF3804] E (No symbol) [0x00007FF74CAF3992] E (No symbol) [0x00007FF74CAEA3EF] E BaseThreadInitThunk [0x00007FFAFC6FE8D7+23] E RtlUserThreadStart [0x00007FFAFD7BC34C+44] D:\Python\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:232: NoSuchWindowException During handling of the above exception, another exception occurred: request = <SubRequest 'get_driver' for <Function test_add_qvlan>>, setup_browsermob_proxy = <MyBaseTest.BaseTest object at 0x000002680CCA0AD0> @pytest.fixture(scope="class") def get_driver(request,setup_browsermob_proxy): # 自动登陆实现 setup_browsermob_proxy.load_config() > setup_browsermob_proxy.sign_in() conftest.py:112: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ MyBaseTest.py:336: in sign_in self.take_screenshot("Sign_Error") MyBaseTest.py:250: in take_screenshot self.driver.save_screenshot(screenshot_path) D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:1021: in save_screenshot return self.get_screenshot_as_file(filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:996: in get_screenshot_as_file png = self.get_screenshot_as_png() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:1030: in get_screenshot_as_png return b64decode(self.get_screenshot_as_base64().encode("ascii")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:1040: in get_screenshot_as_base64 return self.execute(Command.SCREENSHOT)["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:454: in execute self.error_handler.check_response(response) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x000002680CCA12B0> response = {'status': 404, 'value': '{"value":{"error":"no such window","message":"no such window: target window already closed\\...07FF74CAEA3EF]\\n\\tBaseThreadInitThunk [0x00007FFAFC6FE8D7+23]\\n\\tRtlUserThreadStart [0x00007FFAFD7BC34C+44]\\n"}}'} def check_response(self, response: dict[str, Any]) -> None: """Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object. :Raises: If the response contains an error message. """ status = response.get("status", None) if not status or status == ErrorCode.SUCCESS: return value = None message = response.get("message", "") screen: str = response.get("screen", "") stacktrace = None if isinstance(status, int): value_json = response.get("value", None) if value_json and isinstance(value_json, str): try: value = json.loads(value_json) if isinstance(value, dict): if len(value) == 1: value = value["value"] status = value.get("error", None) if not status: status = value.get("status", ErrorCode.UNKNOWN_ERROR) message = value.get("value") or value.get("message") if not isinstance(message, str): value = message message = message.get("message") else: message = value.get("message", None) except ValueError: pass exception_class: type[WebDriverException] e = ErrorCode() error_codes = [item for item in dir(e) if not item.startswith("__")] for error_code in error_codes: error_info = getattr(ErrorCode, error_code) if isinstance(error_info, list) and status in error_info: exception_class = getattr(ExceptionMapping, error_code, WebDriverException) break else: exception_class = WebDriverException if not value: value = response["value"] if isinstance(value, str): raise exception_class(value) if message == "" and "message" in value: message = value["message"] screen = None # type: ignore[assignment] if "screen" in value: screen = value["screen"] stacktrace = None st_value = value.get("stackTrace") or value.get("stacktrace") if st_value: if isinstance(st_value, str): stacktrace = st_value.split("\n") else: stacktrace = [] try: for frame in st_value: line = frame.get("lineNumber", "") file = frame.get("fileName", "<anonymous>") if line: file = f"{file}:{line}" meth = frame.get("methodName", "<anonymous>") if "className" in frame: meth = f"{frame['className']}.{meth}" msg = " at %s (%s)" msg = msg % (meth, file) stacktrace.append(msg) except TypeError: pass if exception_class == UnexpectedAlertPresentException: alert_text = None if "data" in value: alert_text = value["data"].get("text") elif "alert" in value: alert_text = value["alert"].get("text") raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here > raise exception_class(message, screen, stacktrace) E selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed E from unknown error: web view not found E (Session info: chrome=127.0.6533.99) E Stacktrace: E GetHandleVerifier [0x00007FF74CB39632+30946] E (No symbol) [0x00007FF74CAEE3C9] E (No symbol) [0x00007FF74C9E6FDA] E (No symbol) [0x00007FF74C9BCB85] E (No symbol) [0x00007FF74CA637A7] E (No symbol) [0x00007FF74CA7A771] E (No symbol) [0x00007FF74CA5C813] E (No symbol) [0x00007FF74CA2A6E5] E (No symbol) [0x00007FF74CA2B021] E GetHandleVerifier [0x00007FF74CC6F83D+1301229] E GetHandleVerifier [0x00007FF74CC7BDB7+1351783] E GetHandleVerifier [0x00007FF74CC72A03+1313971] E GetHandleVerifier [0x00007FF74CB6DD06+245686] E (No symbol) [0x00007FF74CAF758F] E (No symbol) [0x00007FF74CAF3804] E (No symbol) [0x00007FF74CAF3992] E (No symbol) [0x00007FF74CAEA3EF] E BaseThreadInitThunk [0x00007FFAFC6FE8D7+23] E RtlUserThreadStart [0x00007FFAFD7BC34C+44] D:\Python\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:232: NoSuchWindowException ---------------------------------------------------------------------------------- Captured log setup ----------------------------------------------------------------------------------- INFO MyBaseTest:MyBaseTest.py:758 url:::http://192.168.11.110:5066/api/TestReport/create-report INFO MyBaseTest:MyBaseTest.py:773 Report Create successfully. Report ID: 317 INFO MyBaseTest:MyBaseTest.py:62 Base Proxy address:localhost:8081 ERROR MyBaseTest:MyBaseTest.py:335 Sign in Error ________________________________________________________________ ERROR at setup of Test_CMG024.test_add_qvlan_port[1234] ________________________________________________________________ self = <MyBaseTest.BaseTest object at 0x000002680CCA0AD0> def sign_in(self): """执行登录操作(中文版)""" try: self.driver.get(self.dev_ip) time.sleep(3.5) > WebDriverWait(self.driver, 5).until( EC.visibility_of_element_located((By.ID, "password")) ) MyBaseTest.py:303: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ D:\Python\Lib\site-packages\selenium\webdriver\support\wait.py:129: in until value = method(self._driver) ^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\support\expected_conditions.py:217: in _predicate return _element_if_visible(driver.find_element(*locator)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:922: in find_element return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:454: in execute self.error_handler.check_response(response) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x000002680CCA12B0> response = {'status': 404, 'value': '{"value":{"error":"no such window","message":"no such window: target window already closed\\...07FF74CAEA3EF]\\n\\tBaseThreadInitThunk [0x00007FFAFC6FE8D7+23]\\n\\tRtlUserThreadStart [0x00007FFAFD7BC34C+44]\\n"}}'} def check_response(self, response: dict[str, Any]) -> None: """Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object. :Raises: If the response contains an error message. """ status = response.get("status", None) if not status or status == ErrorCode.SUCCESS: return value = None message = response.get("message", "") screen: str = response.get("screen", "") stacktrace = None if isinstance(status, int): value_json = response.get("value", None) if value_json and isinstance(value_json, str): try: value = json.loads(value_json) if isinstance(value, dict): if len(value) == 1: value = value["value"] status = value.get("error", None) if not status: status = value.get("status", ErrorCode.UNKNOWN_ERROR) message = value.get("value") or value.get("message") if not isinstance(message, str): value = message message = message.get("message") else: message = value.get("message", None) except ValueError: pass exception_class: type[WebDriverException] e = ErrorCode() error_codes = [item for item in dir(e) if not item.startswith("__")] for error_code in error_codes: error_info = getattr(ErrorCode, error_code) if isinstance(error_info, list) and status in error_info: exception_class = getattr(ExceptionMapping, error_code, WebDriverException) break else: exception_class = WebDriverException if not value: value = response["value"] if isinstance(value, str): raise exception_class(value) if message == "" and "message" in value: message = value["message"] screen = None # type: ignore[assignment] if "screen" in value: screen = value["screen"] stacktrace = None st_value = value.get("stackTrace") or value.get("stacktrace") if st_value: if isinstance(st_value, str): stacktrace = st_value.split("\n") else: stacktrace = [] try: for frame in st_value: line = frame.get("lineNumber", "") file = frame.get("fileName", "<anonymous>") if line: file = f"{file}:{line}" meth = frame.get("methodName", "<anonymous>") if "className" in frame: meth = f"{frame['className']}.{meth}" msg = " at %s (%s)" msg = msg % (meth, file) stacktrace.append(msg) except TypeError: pass if exception_class == UnexpectedAlertPresentException: alert_text = None if "data" in value: alert_text = value["data"].get("text") elif "alert" in value: alert_text = value["alert"].get("text") raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here > raise exception_class(message, screen, stacktrace) E selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed E from unknown error: web view not found E (Session info: chrome=127.0.6533.99) E Stacktrace: E GetHandleVerifier [0x00007FF74CB39632+30946] E (No symbol) [0x00007FF74CAEE3C9] E (No symbol) [0x00007FF74C9E6FDA] E (No symbol) [0x00007FF74C9BCB85] E (No symbol) [0x00007FF74CA637A7] E (No symbol) [0x00007FF74CA7A771] E (No symbol) [0x00007FF74CA5C813] E (No symbol) [0x00007FF74CA2A6E5] E (No symbol) [0x00007FF74CA2B021] E GetHandleVerifier [0x00007FF74CC6F83D+1301229] E GetHandleVerifier [0x00007FF74CC7BDB7+1351783] E GetHandleVerifier [0x00007FF74CC72A03+1313971] E GetHandleVerifier [0x00007FF74CB6DD06+245686] E (No symbol) [0x00007FF74CAF758F] E (No symbol) [0x00007FF74CAF3804] E (No symbol) [0x00007FF74CAF3992] E (No symbol) [0x00007FF74CAEA3EF] E BaseThreadInitThunk [0x00007FFAFC6FE8D7+23] E RtlUserThreadStart [0x00007FFAFD7BC34C+44] D:\Python\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:232: NoSuchWindowException During handling of the above exception, another exception occurred: request = <SubRequest 'get_driver' for <Function test_add_qvlan>>, setup_browsermob_proxy = <MyBaseTest.BaseTest object at 0x000002680CCA0AD0> @pytest.fixture(scope="class") def get_driver(request,setup_browsermob_proxy): # 自动登陆实现 setup_browsermob_proxy.load_config() > setup_browsermob_proxy.sign_in() conftest.py:112: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ MyBaseTest.py:336: in sign_in self.take_screenshot("Sign_Error") MyBaseTest.py:250: in take_screenshot self.driver.save_screenshot(screenshot_path) D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:1021: in save_screenshot return self.get_screenshot_as_file(filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:996: in get_screenshot_as_file png = self.get_screenshot_as_png() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:1030: in get_screenshot_as_png return b64decode(self.get_screenshot_as_base64().encode("ascii")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:1040: in get_screenshot_as_base64 return self.execute(Command.SCREENSHOT)["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:454: in execute self.error_handler.check_response(response) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x000002680CCA12B0> response = {'status': 404, 'value': '{"value":{"error":"no such window","message":"no such window: target window already closed\\...07FF74CAEA3EF]\\n\\tBaseThreadInitThunk [0x00007FFAFC6FE8D7+23]\\n\\tRtlUserThreadStart [0x00007FFAFD7BC34C+44]\\n"}}'} def check_response(self, response: dict[str, Any]) -> None: """Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object. :Raises: If the response contains an error message. """ status = response.get("status", None) if not status or status == ErrorCode.SUCCESS: return value = None message = response.get("message", "") screen: str = response.get("screen", "") stacktrace = None if isinstance(status, int): value_json = response.get("value", None) if value_json and isinstance(value_json, str): try: value = json.loads(value_json) if isinstance(value, dict): if len(value) == 1: value = value["value"] status = value.get("error", None) if not status: status = value.get("status", ErrorCode.UNKNOWN_ERROR) message = value.get("value") or value.get("message") if not isinstance(message, str): value = message message = message.get("message") else: message = value.get("message", None) except ValueError: pass exception_class: type[WebDriverException] e = ErrorCode() error_codes = [item for item in dir(e) if not item.startswith("__")] for error_code in error_codes: error_info = getattr(ErrorCode, error_code) if isinstance(error_info, list) and status in error_info: exception_class = getattr(ExceptionMapping, error_code, WebDriverException) break else: exception_class = WebDriverException if not value: value = response["value"] if isinstance(value, str): raise exception_class(value) if message == "" and "message" in value: message = value["message"] screen = None # type: ignore[assignment] if "screen" in value: screen = value["screen"] stacktrace = None st_value = value.get("stackTrace") or value.get("stacktrace") if st_value: if isinstance(st_value, str): stacktrace = st_value.split("\n") else: stacktrace = [] try: for frame in st_value: line = frame.get("lineNumber", "") file = frame.get("fileName", "<anonymous>") if line: file = f"{file}:{line}" meth = frame.get("methodName", "<anonymous>") if "className" in frame: meth = f"{frame['className']}.{meth}" msg = " at %s (%s)" msg = msg % (meth, file) stacktrace.append(msg) except TypeError: pass if exception_class == UnexpectedAlertPresentException: alert_text = None if "data" in value: alert_text = value["data"].get("text") elif "alert" in value: alert_text = value["alert"].get("text") raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here > raise exception_class(message, screen, stacktrace) E selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed E from unknown error: web view not found E (Session info: chrome=127.0.6533.99) E Stacktrace: E GetHandleVerifier [0x00007FF74CB39632+30946] E (No symbol) [0x00007FF74CAEE3C9] E (No symbol) [0x00007FF74C9E6FDA] E (No symbol) [0x00007FF74C9BCB85] E (No symbol) [0x00007FF74CA637A7] E (No symbol) [0x00007FF74CA7A771] E (No symbol) [0x00007FF74CA5C813] E (No symbol) [0x00007FF74CA2A6E5] E (No symbol) [0x00007FF74CA2B021] E GetHandleVerifier [0x00007FF74CC6F83D+1301229] E GetHandleVerifier [0x00007FF74CC7BDB7+1351783] E GetHandleVerifier [0x00007FF74CC72A03+1313971] E GetHandleVerifier [0x00007FF74CB6DD06+245686] E (No symbol) [0x00007FF74CAF758F] E (No symbol) [0x00007FF74CAF3804] E (No symbol) [0x00007FF74CAF3992] E (No symbol) [0x00007FF74CAEA3EF] E BaseThreadInitThunk [0x00007FFAFC6FE8D7+23] E RtlUserThreadStart [0x00007FFAFD7BC34C+44] D:\Python\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:232: NoSuchWindowException ___________________________________________________________________ ERROR at setup of Test_CMG024.test_qvlan_boundary ___________________________________________________________________ self = <MyBaseTest.BaseTest object at 0x000002680CCA0AD0> def sign_in(self): """执行登录操作(中文版)""" try: self.driver.get(self.dev_ip) time.sleep(3.5) > WebDriverWait(self.driver, 5).until( EC.visibility_of_element_located((By.ID, "password")) ) MyBaseTest.py:303: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ D:\Python\Lib\site-packages\selenium\webdriver\support\wait.py:129: in until value = method(self._driver) ^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\support\expected_conditions.py:217: in _predicate return _element_if_visible(driver.find_element(*locator)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:922: in find_element return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:454: in execute self.error_handler.check_response(response) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x000002680CCA12B0> response = {'status': 404, 'value': '{"value":{"error":"no such window","message":"no such window: target window already closed\\...07FF74CAEA3EF]\\n\\tBaseThreadInitThunk [0x00007FFAFC6FE8D7+23]\\n\\tRtlUserThreadStart [0x00007FFAFD7BC34C+44]\\n"}}'} def check_response(self, response: dict[str, Any]) -> None: """Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object. :Raises: If the response contains an error message. """ status = response.get("status", None) if not status or status == ErrorCode.SUCCESS: return value = None message = response.get("message", "") screen: str = response.get("screen", "") stacktrace = None if isinstance(status, int): value_json = response.get("value", None) if value_json and isinstance(value_json, str): try: value = json.loads(value_json) if isinstance(value, dict): if len(value) == 1: value = value["value"] status = value.get("error", None) if not status: status = value.get("status", ErrorCode.UNKNOWN_ERROR) message = value.get("value") or value.get("message") if not isinstance(message, str): value = message message = message.get("message") else: message = value.get("message", None) except ValueError: pass exception_class: type[WebDriverException] e = ErrorCode() error_codes = [item for item in dir(e) if not item.startswith("__")] for error_code in error_codes: error_info = getattr(ErrorCode, error_code) if isinstance(error_info, list) and status in error_info: exception_class = getattr(ExceptionMapping, error_code, WebDriverException) break else: exception_class = WebDriverException if not value: value = response["value"] if isinstance(value, str): raise exception_class(value) if message == "" and "message" in value: message = value["message"] screen = None # type: ignore[assignment] if "screen" in value: screen = value["screen"] stacktrace = None st_value = value.get("stackTrace") or value.get("stacktrace") if st_value: if isinstance(st_value, str): stacktrace = st_value.split("\n") else: stacktrace = [] try: for frame in st_value: line = frame.get("lineNumber", "") file = frame.get("fileName", "<anonymous>") if line: file = f"{file}:{line}" meth = frame.get("methodName", "<anonymous>") if "className" in frame: meth = f"{frame['className']}.{meth}" msg = " at %s (%s)" msg = msg % (meth, file) stacktrace.append(msg) except TypeError: pass if exception_class == UnexpectedAlertPresentException: alert_text = None if "data" in value: alert_text = value["data"].get("text") elif "alert" in value: alert_text = value["alert"].get("text") raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here > raise exception_class(message, screen, stacktrace) E selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed E from unknown error: web view not found E (Session info: chrome=127.0.6533.99) E Stacktrace: E GetHandleVerifier [0x00007FF74CB39632+30946] E (No symbol) [0x00007FF74CAEE3C9] E (No symbol) [0x00007FF74C9E6FDA] E (No symbol) [0x00007FF74C9BCB85] E (No symbol) [0x00007FF74CA637A7] E (No symbol) [0x00007FF74CA7A771] E (No symbol) [0x00007FF74CA5C813] E (No symbol) [0x00007FF74CA2A6E5] E (No symbol) [0x00007FF74CA2B021] E GetHandleVerifier [0x00007FF74CC6F83D+1301229] E GetHandleVerifier [0x00007FF74CC7BDB7+1351783] E GetHandleVerifier [0x00007FF74CC72A03+1313971] E GetHandleVerifier [0x00007FF74CB6DD06+245686] E (No symbol) [0x00007FF74CAF758F] E (No symbol) [0x00007FF74CAF3804] E (No symbol) [0x00007FF74CAF3992] E (No symbol) [0x00007FF74CAEA3EF] E BaseThreadInitThunk [0x00007FFAFC6FE8D7+23] E RtlUserThreadStart [0x00007FFAFD7BC34C+44] D:\Python\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:232: NoSuchWindowException During handling of the above exception, another exception occurred: request = <SubRequest 'get_driver' for <Function test_add_qvlan>>, setup_browsermob_proxy = <MyBaseTest.BaseTest object at 0x000002680CCA0AD0> @pytest.fixture(scope="class") def get_driver(request,setup_browsermob_proxy): # 自动登陆实现 setup_browsermob_proxy.load_config() > setup_browsermob_proxy.sign_in() conftest.py:112: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ MyBaseTest.py:336: in sign_in self.take_screenshot("Sign_Error") MyBaseTest.py:250: in take_screenshot self.driver.save_screenshot(screenshot_path) D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:1021: in save_screenshot return self.get_screenshot_as_file(filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:996: in get_screenshot_as_file png = self.get_screenshot_as_png() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:1030: in get_screenshot_as_png return b64decode(self.get_screenshot_as_base64().encode("ascii")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:1040: in get_screenshot_as_base64 return self.execute(Command.SCREENSHOT)["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D:\Python\Lib\site-packages\selenium\webdriver\remote\webdriver.py:454: in execute self.error_handler.check_response(response) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x000002680CCA12B0> response = {'status': 404, 'value': '{"value":{"error":"no such window","message":"no such window: target window already closed\\...07FF74CAEA3EF]\\n\\tBaseThreadInitThunk [0x00007FFAFC6FE8D7+23]\\n\\tRtlUserThreadStart [0x00007FFAFD7BC34C+44]\\n"}}'} def check_response(self, response: dict[str, Any]) -> None: """Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object. :Raises: If the response contains an error message. """ status = response.get("status", None) if not status or status == ErrorCode.SUCCESS: return value = None message = response.get("message", "") screen: str = response.get("screen", "") stacktrace = None if isinstance(status, int): value_json = response.get("value", None) if value_json and isinstance(value_json, str): try: value = json.loads(value_json) if isinstance(value, dict): if len(value) == 1: value = value["value"] status = value.get("error", None) if not status: status = value.get("status", ErrorCode.UNKNOWN_ERROR) message = value.get("value") or value.get("message") if not isinstance(message, str): value = message message = message.get("message") else: message = value.get("message", None) except ValueError: pass exception_class: type[WebDriverException] e = ErrorCode() error_codes = [item for item in dir(e) if not item.startswith("__")] for error_code in error_codes: error_info = getattr(ErrorCode, error_code) if isinstance(error_info, list) and status in error_info: exception_class = getattr(ExceptionMapping, error_code, WebDriverException) break else: exception_class = WebDriverException if not value: value = response["value"] if isinstance(value, str): raise exception_class(value) if message == "" and "message" in value: message = value["message"] screen = None # type: ignore[assignment] if "screen" in value: screen = value["screen"] stacktrace = None st_value = value.get("stackTrace") or value.get("stacktrace") if st_value: if isinstance(st_value, str): stacktrace = st_value.split("\n") else: stacktrace = [] try: for frame in st_value: line = frame.get("lineNumber", "") file = frame.get("fileName", "<anonymous>") if line: file = f"{file}:{line}" meth = frame.get("methodName", "<anonymous>") if "className" in frame: meth = f"{frame['className']}.{meth}" msg = " at %s (%s)" msg = msg % (meth, file) stacktrace.append(msg) except TypeError: pass if exception_class == UnexpectedAlertPresentException: alert_text = None if "data" in value: alert_text = value["data"].get("text") elif "alert" in value: alert_text = value["alert"].get("text") raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here > raise exception_class(message, screen, stacktrace) E selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed E from unknown error: web view not found E (Session info: chrome=127.0.6533.99) E Stacktrace: E GetHandleVerifier [0x00007FF74CB39632+30946] E (No symbol) [0x00007FF74CAEE3C9] E (No symbol) [0x00007FF74C9E6FDA] E (No symbol) [0x00007FF74C9BCB85] E (No symbol) [0x00007FF74CA637A7] E (No symbol) [0x00007FF74CA7A771] E (No symbol) [0x00007FF74CA5C813] E (No symbol) [0x00007FF74CA2A6E5] E (No symbol) [0x00007FF74CA2B021] E GetHandleVerifier [0x00007FF74CC6F83D+1301229] E GetHandleVerifier [0x00007FF74CC7BDB7+1351783] E GetHandleVerifier [0x00007FF74CC72A03+1313971] E GetHandleVerifier [0x00007FF74CB6DD06+245686] E (No symbol) [0x00007FF74CAF758F] E (No symbol) [0x00007FF74CAF3804] E (No symbol) [0x00007FF74CAF3992] E (No symbol) [0x00007FF74CAEA3EF] E BaseThreadInitThunk [0x00007FFAFC6FE8D7+23] E RtlUserThreadStart [0x00007FFAFD7BC34C+44] D:\Python\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:232: NoSuchWindowException =================================================================================== warnings summary ==================================================================================== CMG_024_test.py:232 c:\Users\Administrator\Desktop\web8\CMG_024_test.py:232: PytestUnknownMarkWarning: Unknown pytest.mark.repeat - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.repeat(6) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html -------------------------------------------------------- generated xml file: C:\Users\Administrator\Desktop\web8\testresults.xml -------------------------------------------------------- HTTP error occurred: 404 Client Error: Not Found for url: http://192.168.11.110:5066/api/TestReport/upload-test-summary?reportId=0&endTime=1754731236491 ------------------------------------------------- Generated html report: file:///C:/Users/Administrator/Desktop/web8/report/report.html ------------------------------------------------- ================================================================================ short test summary info ================================================================================ ERROR CMG_024_test.py::Test_CMG024::test_add_qvlan - selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed ERROR CMG_024_test.py::Test_CMG024::test_add_qvlan_port[1234] - selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed ERROR CMG_024_test.py::Test_CMG024::test_qvlan_boundary - selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed ============================================================================= 1 warning, 3 errors in 20.23s ============================================================================= PS C:\Users\Administrator\Desktop\web8>
最新发布
08-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值