
    ^j                        U d dl Z d dlmZmZmZmZmZmZ d dlm	c m
Z d dlmZ d dlm	c m
Z i dej                   dej"                  dej$                  dej&                  dej(                  d	ej*                  d
ej,                  dej.                  dej0                  dej2                  dej4                  dej6                  dej8                  dej:                  dej<                  dej>                  dej@                  ejB                  ejD                  ej>                  ej@                  ejF                  ejH                  ejJ                  ejL                  ejN                  ejL                  ejL                  ejP                  ejR                  ejT                  dZ+ee,eejN                     f   e-d<   dede,ef   dee,   fdZ. G d dej^                        Z0y)    N)AnyDictListSequenceTypeUnion)errorhandlerzelement click interceptedzelement not interactablezinsecure certificatezinvalid argumentzinvalid cookie domainzinvalid element statezinvalid selectorzinvalid session idzjavascript errorzmove target out of boundszno such alertzno such cookiezno such elementzno such framezno such windowzno such shadow rootzscript timeout)zsession not createdzstale element referencezdetached shadow roottimeoutzunable to set cookiezunable to capture screenzunexpected alert openzunknown commandzunknown errorzunknown methodzunsupported operationzelement not visiblezelement not selectablezinvalid coordinatesERROR_TO_EXC_MAPPINGoriginalreturnc                 r   | sg S t        | t              r| j                  d      S g }	 | D ]x  }t        |t              s|j	                  dd      }|j	                  dd      }|r| d| }|j	                  dd      }d|v r
|d    d	| }|j                  d
| d| d       z 	 |S # t        $ r Y |S w xY w)N

lineNumber fileNamez<anonymous>:
methodName	className.z    at z ())
isinstancestrsplitdictgetappend	TypeError)r   resultframelinefilemeths         Q/home/ubuntu/.local/lib/python3.12/site-packages/appium/webdriver/errorhandler.pyformat_stacktracer%   :   s    	(C ~~d##F 	5EeT*99\2.D99Z7Dq'99\=9De#,-Qtf5MMGD6D634	5 M  Ms   A=B) )	B65B6c                   &    e Zd Zdeeef   ddfdZy)MobileErrorHandlerresponser   Nc                    |j                  dd      }t        |t              r|}n'	 t        j                  |      }t        |t              sy|j                  d      }t        |t              sy|j                  d      }|sy|j                  d|      }|j                  dd      }t        j                  |t        j                        }|t        j                  u r-|r+|dk(  rt        j                  }n|dk(  rt        j                  }|t        j                  u r0t        j                  |t        |      |j                  d	      
       ||t        |            # t        j
                  t        f$ r Y yw xY w)z9
        https://www.w3.org/TR/webdriver/#errors
        valuer   Nerrormessage
stacktracezNo such context found.z:That command could not be executed in the current context.data)msgr-   
alert_text)r/   r-   )r   r   r   jsonloadsJSONDecodeErrorr   r   sel_exceptionsWebDriverExceptionappium_exceptionsNoSuchContextExceptionInvalidSwitchToTargetExceptionUnexpectedAlertPresentExceptionr%   )	selfr(   payloadpayload_dictr*   r+   r,   r-   exception_classs	            r$   check_responsez!MobileErrorHandler.check_responseT   s\    ,,w+gt$"L#zz'2 lD1  )%&		'"))Iu-YY|R0
 DXC[C[>44D
 n???G22"3"J"JXX"3"R"RnLLL @@,Z8 99V, 
 '6G
6STT? (()4 s   E E;:E;)__name__
__module____qualname__r   r   r   r>        r$   r'   r'   S   s     )UtCH~ )U$ )UrC   r'   )1r1   typingr   r   r   r   r   r   selenium.common.exceptionscommon
exceptionsr4   selenium.webdriver.remoter	   appium.common.exceptionsr6    ElementClickInterceptedExceptionElementNotInteractableExceptionInsecureCertificateExceptionInvalidArgumentExceptionInvalidCookieDomainExceptionInvalidElementStateExceptionInvalidSelectorExceptionInvalidSessionIdExceptionJavascriptExceptionMoveTargetOutOfBoundsExceptionNoAlertPresentExceptionNoSuchCookieExceptionNoSuchElementExceptionNoSuchFrameExceptionNoSuchWindowExceptionNoSuchShadowRootExceptionTimeoutExceptionSessionNotCreatedExceptionStaleElementReferenceExceptionUnableToSetCookieExceptionScreenshotExceptionr9   UnknownMethodExceptionr5   ElementNotVisibleExceptionElementNotSelectableExceptionInvalidCoordinatesExceptionr   r   __annotations__r%   ErrorHandlerr'   rB   rC   r$   <module>re      sA    9 9 3 3 2 4 4 L!P!P L N N L NGG L ??	 L
 ^HH L ^HH L ?? L .BB L :: L  !N!N L ^;; L n:: L ~<< L ^88 L n:: L  >CC! L" n55# L$ *DD-LL*DD..*EE . B B+KK%<<#66$;;+BB)DD,JJ)EE? L d3^%F%F GGH  FdC&9 : tCy 2*U22 *UrC   