<divclass="log">@pytest.mark.case3<br/> def test_login2():<br/> browser = BrowserEngine()<br/>> browser.login_znfz()<br/><br/>test_login.py:67: <br/>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ <br/>..\baseuse\browser_engine.py:46: in login_znfz<br/> driver = browser.open_browser()<br/>..\baseuse\browser_engine.py:25: in open_browser<br/> driver.maximize_window()<br/>d:\python\lib\site-packages\selenium\webdriver\remote\webdriver.py:737: in maximize_window<br/> self.execute(command, params)<br/>d:\python\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute<br/> self.error_handler.check_response(response)<br/>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ <br/><br/>self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x00000123BA5765E0><br/>response = {'sessionId': '7cb322a945d0d22858e020ac61b82c59', 'status': 13, 'value': {'message': 'unknown error: failed to change ...ver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.18362 x86_64)'}}<br/><br/> def check_response(self, response):<br/>"""<br/> Checks that a JSON response from the WebDriver does not have an error.<br/><br/> :Args:<br/> - response - The JSON response from the WebDriver server as a dictionary<br/> object.<br/><br/> :Raises: If the response contains an error message.<br/>"""<br/> status = response.get('status', None)<br/> if status is None or status == ErrorCode.SUCCESS:<br/> return<br/> value = None<br/> message = response.get("message", "")<br/> screen = response.get("screen", "")<br/> stacktrace = None<br/> if isinstance(status, int):<br/> value_json = response.get('value', None)<br/> if value_json and isinstance(value_json, basestring):<br/> import json<br/> try:<br/> value = json.loads(value_json)<br/> if len(value.keys()) == 1:<br/> value = value['value']<br/> status = value.get('error', None)<br/> if status is None:<br/> status = value["status"]<br/> message = value["value"]<br/> if not isinstance(message, basestring):<br/> value = message<br/> message = message.get('message')<br/> else:<br/> message = value.get('message', None)<br/> except ValueError:<br/> pass<br/><br/> exception_class = ErrorInResponseException<br/> if status in ErrorCode.NO_SUCH_ELEMENT:<br/> exception_class = NoSuchElementException<br/> elif status in ErrorCode.NO_SUCH_FRAME:<br/> exception_class = NoSuchFrameException<br/> elif status in ErrorCode.NO_SUCH_WINDOW:<br/> exception_class = NoSuchWindowException<br/> elif status in ErrorCode.STALE_ELEMENT_REFERENCE:<br/> exception_class = StaleElementReferenceException<br/> elif status in ErrorCode.ELEMENT_NOT_VISIBLE:<br/> exception_class = ElementNotVisibleException<br/> elif status in ErrorCode.INVALID_ELEMENT_STATE:<br/> exception_class = InvalidElementStateException<br/> elif status in ErrorCode.INVALID_SELECTOR \<br/> or status in ErrorCode.INVALID_XPATH_SELECTOR \<br/> or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:<br/> exception_class = InvalidSelectorException<br/> elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:<br/> exception_class = ElementNotSelectableException<br/> elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:<br/> exception_class = ElementNotInteractableException<br/> elif status in ErrorCode.INVALID_COOKIE_DOMAIN:<br/> exception_class = InvalidCookieDomainException<br/> elif status in ErrorCode.UNABLE_TO_SET_COOKIE:<br/> exception_class = UnableToSetCookieException<br/> elif status in ErrorCode.TIMEOUT:<br/> exception_class = TimeoutException<br/> elif status in ErrorCode.SCRIPT_TIMEOUT:<br/> exception_class = TimeoutException<br/> elif status in ErrorCode.UNKNOWN_ERROR:<br/> exception_class = WebDriverException<br/> elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:<br/> exception_class = UnexpectedAlertPresentException<br/> elif status in ErrorCode.NO_ALERT_OPEN:<br/> exception_class = NoAlertPresentException<br/> elif status in ErrorCode.IME_NOT_AVAILABLE:<br/> exception_class = ImeNotAvailableException<br/> elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:<br/> exception_class = ImeActivationFailedException<br/> elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:<br/> exception_class = MoveTargetOutOfBoundsException<br/> elif status in ErrorCode.JAVASCRIPT_ERROR:<br/> exception_class = JavascriptException<br/> elif status in ErrorCode.SESSION_NOT_CREATED:<br/> exception_class = SessionNotCreatedException<br/> elif status in ErrorCode.INVALID_ARGUMENT:<br/> exception_class = InvalidArgumentException<br/> elif status in ErrorCode.NO_SUCH_COOKIE:<br/> exception_class = NoSuchCookieException<br/> elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:<br/> exception_class = ScreenshotException<br/> elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:<br/> exception_class = ElementClickInterceptedException<br/> elif status in ErrorCode.INSECURE_CERTIFICATE:<br/> exception_class = InsecureCertificateException<br/> elif status in ErrorCode.INVALID_COORDINATES:<br/> exception_class = InvalidCoordinatesException<br/> elif status in ErrorCode.INVALID_SESSION_ID:<br/> exception_class = InvalidSessionIdException<br/> elif status in ErrorCode.UNKNOWN_METHOD:<br/> exception_class = UnknownMethodException<br/> else:<br/> exception_class = WebDriverException<br/> if value == '' or value is None:<br/> value = response['value']<br/> if isinstance(value, basestring):<br/> if exception_class == ErrorInResponseException:<br/> raise exception_class(response, value)<br/> raise exception_class(value)<br/> if message == "" and 'message' in value:<br/> message = value['message']<br/><br/> screen = None<br/> if 'screen' in value:<br/> screen = value['screen']<br/><br/> stacktrace = None<br/> if 'stackTrace' in value and value['stackTrace']:<br/> stacktrace = []<br/> try:<br/> for frame in value['stackTrace']:<br/> line = self._value_or_default(frame, 'lineNumber', '')<br/> file = self._value_or_default(frame, 'fileName', '<anonymous>')<br/> if line:<br/> file = "%s:%s" % (file, line)<br/> meth = self._value_or_default(frame, 'methodName', '<anonymous>')<br/> if 'className' in frame:<br/> meth = "%s.%s" % (frame['className'], meth)<br/> msg = " at %s (%s)"<br/> msg = msg % (meth, file)<br/> stacktrace.append(msg)<br/> except TypeError:<br/> pass<br/> if exception_class == ErrorInResponseException:<br/> raise exception_class(response, message)<br/> elif exception_class == UnexpectedAlertPresentException:<br/> alert_text = None<br/> if 'data' in value:<br/> alert_text = value['data'].get('text')<br/> elif 'alert' in value:<br/> alert_text = value['alert'].get('text')<br/> raise exception_class(message, screen, stacktrace, alert_text)<br/>> raise exception_class(message, screen, stacktrace)<br/><spanclass="error">E selenium.common.exceptions.WebDriverException: Message: unknown error: failed to change window state to maximized, current state is normal</span><br/><spanclass="error">E (Session info: chrome=83.0.4103.61)</span><br/><spanclass="error">E (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.18362 x86_64)</span><br/><br/>d:\python\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: WebDriverException<br/> -----------------------------Captured stdout setup------------------------------ <br/>setup_function:每个用例开始前都会执行