
    +g                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
Jr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK J!r!  SSK"J#r#  SSK"J$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*  SSK)J+r+  SSK)J,r,  SSK-J.r.  SSK/J0r0  SS K1J2r2  SS!K3J4r4  SS"K5J6r6  SS#K7J8r8  SS$K9J:r:  SS%K;J<r<  SS&K;J=r=  SS'K>J?r?  SS(K@JArA  SS)KBJCrC  SS*KDJErE  SS+KFJGrG  SS,KHJIrI  SS-KJJKrK  SS.KLJMrM  SqNSqOS/ rPS0 rQ S?S1\RS2\\S\C4   S3\TS4\TS5\\4   S6\C4S7 jjrUS8\\$   S6\4S9 jrV " S: S;\S<9rW " S= S>\W5      rXg)@zThe WebDriver implementation.    N)ABCMeta)	b64decode)urlsafe_b64encode)asynccontextmanager)contextmanager)import_module)Dict)List)Optional)Type)Union)InvalidArgumentException)JavascriptException)NoSuchCookieException)NoSuchElementException)WebDriverException)Script)By)
ArgOptions)BaseOptions)PrintOptions)Timeouts)
Credential)VirtualAuthenticatorOptions)required_virtual_authenticator)
RelativeBy   )Dialog   )BidiConnection)ClientConfig)Command)ErrorHandler)FedCM)FileDetector)LocalFileDetector)LocatorConverter)Mobile)RemoteConnection)	ScriptKey)
ShadowRoot)SwitchTo)
WebElement)WebSocketConnectionc                  2    [         (       d  [        S5      q g g )Nz"selenium.webdriver.common.bidi.cdp)cdpr        k/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/selenium/webdriver/remote/webdriver.py
import_cdpr4   N   s    3@A r2   c                 |    [         R                  " U 5      n 0 nU R                  5        H	  u  p#X1U'   M     S0 /US.0$ )a{  Makes a W3C alwaysMatch capabilities object.

Filters out capability names that are not in the W3C spec. Spec-compliant
drivers will reject requests containing unknown capability names.

Moves the Firefox profile, if present, from the old location to the new Firefox
options object.

Parameters:
----------
caps : dict
    - A dictionary of capabilities requested by the caller.
capabilities)
firstMatchalwaysMatch)copydeepcopyitems)capsalways_matchkvs       r3   _create_capsr@   T   sB     ==DL

Q B4MNNr2   r6   command_executor
keep_aliveignore_local_proxyclient_configreturnc                    ^  [        U[        5      (       a!  U=(       d	    [        US9nXl        [	        US9nSSKJn  SSKJn  SSK	J
n  SSKJn  XVX/n	[        U 4S jU	 5       [        5      n
U
" UUUUS	9$ )
N)remote_server_addr)rD   r   )ChromeRemoteConnection)EdgeRemoteConnection)FirefoxRemoteConnection)SafariRemoteConnectionc              3   h   >#    U  H'  oR                   TR                  S 5      :X  d  M#  Uv   M)     g7f)browserNameN)browser_nameget).0cr6   s     r3   	<genexpr>(get_remote_connection.<locals>.<genexpr>z   s(     _z!^^|?O?OP]?^-^AAzs   "2	2)rG   rB   ignore_proxyrD   )
isinstancestrr!   rG   r)   +selenium.webdriver.chrome.remote_connectionrH   )selenium.webdriver.edge.remote_connectionrI   ,selenium.webdriver.firefox.remote_connectionrJ   +selenium.webdriver.safari.remote_connectionrK   next)r6   rA   rB   rC   rD   rH   rI   rJ   rK   
candidateshandlers   `          r3   get_remote_connectionr^   i   sw     "C((%ZIY)Z+;(+-HRNTR(@VpJ_z_aqrG+'#	 r2   optionsc                    S0 0n/ nU  H"  nUR                  UR                  5       5        M$     [        U5      n0 n[        U5       Hs  nUnUS-   U:  d  M  X'   R	                  5       nU HK  n	XUS-      R	                  5       ;   d  M  X'   U	   X&S-      U	   :X  d  M3  UR                  XU   U	   05        MM     Mu     0 n
UR                  5        H	  u  pXU'   M     U H  nU
 H  nXk	 M     M     XS   S'   X!S   S'   U$ )Nr6   r   r8   r7   )appendto_capabilitieslenrangekeysupdater;   )r_   r6   optsopt	opts_sizesamesiesi	min_index
first_keyskysalwaysr>   r?   s                r3   create_matchesrp      s!   "B'LDC'')* D	IH 9	q59--/J!q1u+**,,s+tE{3/?? 9oc.B(CD "  F q	 ! A   39 /15 .r2   c                       \ rS rSrSrSrg)BaseWebDriver   zAbstract Base Class for all Webdriver subtypes.

ABC's allow custom implementations of Webdriver to be registered so
that isinstance type checks will succeed.
r1   N)__name__
__module____qualname____firstlineno____doc____static_attributes__r1   r2   r3   rr   rr      s    r2   rr   )	metaclassc                      \ rS rSrSr\r\r       S{S\	\
\4   S\S\\   S\\	\\\   4      S\\   S	\\   S
\\   SS4S jjrS rS rS\\\      S\\   S\\R4                     4S jr\S 5       r\S\4S j5       r \S\
4S j5       r!S r"S r#S\$SS4S jr%S r&S\
S\4S jr'S r(S\
S\$4S  jr)S|S!\
S"\$S\$4S# jjr*S$\
SS4S% jr+\S\
4S& j5       r,S|S'\
S\-4S( jjr.S)\-SS4S* jr/S\\
   4S+ jr0S, r1S'\
4S- jr2\S\
4S. j5       r3\S\
4S/ j5       r4S}S0 jr5S}S1 jr6\S\
4S2 j5       r7\S\\
   4S3 j5       r8S}S4 jr9S}S5 jr:S}S6 jr;S|S7\\<   S\
4S8 jjr=\S\>4S9 j5       r?S}S: jr@S}S; jrAS}S< jrBS\\$   4S= jrCS\\D   4S> jrES}S? jrFS}S@ jrGS}SA jrHSB\ISS4SC jrJSB\ISS4SD jrKSB\ISS4SE jrL\S\M4SF j5       rN\NR                  S}SG j5       rN\PR                  S4SH\\
   S\4SI jjrR\PR                  S4SH\\
   S\\   4SJ jjrS\S\$4SK j5       rTS\4SL jrUS\4SM jrVS\W4SN jrXS\
4SO jrYS~SP\
SS4SQ jjrZS~SP\
S\$4SR jjr[S~SS\IST\ISP\
S\$4SU jjr\S~S\$4SV jjr]SP\
SS4SW jr^S\$4SX jr_SS\$4SY jjr`\S\4SZ j5       ra\aR                  S}S[ j5       ra\S\ 5       rb\bR                  S}S] j5       rb\S^ 5       rcS_ rdS` re\fSa 5       rg\Sb 5       rhSc riSd rjS\kSS4Se jrl\S\
4Sf j5       rm\nS}Sg j5       ro\nSh\pSS4Si j5       rq\nS\\p   4Sj j5       rr\nSk\	\
\s4   SS4Sl j5       rt\nS}Sm j5       ru\nSn\SS4So j5       rvS\w4Sp jrxSq\
Sr\
SS4Ss jryS}St jrz\S\{4Su j5       r|\S\4Sv j5       r}Sw r~\Sx 5       rSSy jrSzrg)	WebDriver   a  Controls a browser by sending commands to a remote server. This server
is expected to be running the WebDriver wire protocol as defined at
https://www.selenium.dev/documentation/legacy/json_wire_protocol/.

Attributes:
----------
session_id - String ID of the browser session started and controlled by this WebDriver.
capabilities - Dictionary of effective capabilities of this browser session as returned
    by the remote server. See https://www.selenium.dev/documentation/legacy/desired_capabilities/
command_executor : str or remote_connection.RemoteConnection object used to execute commands.
error_handler - errorhandler.ErrorHandler object used to handle errors.
NrA   rB   file_detectorr_   locator_converterweb_element_clsrD   rE   c                    [        U[        5      (       a  [        U5      nSn	OUR                  5       nUR                  n	Xl        [        U R
                  [        [        45      (       a  [        UUUU	US9U l        SU l	        SU l
        0 U l        0 U l        [        5       U l        [        U 5      U l        [#        U 5      U l        U=(       d
    ['        5       U l        U=(       d
    [+        5       U l        U=(       d    U R.                  U l        SU l        U R3                  5         U R5                  U5        [7        U 5      U l        SU l        SU l        g)a  Create a new driver that will issue commands using the wire
protocol.

Parameters:
----------
command_executor : str or remote_connection.RemoteConnection
    - Either a string representing the URL of the remote server or a custom
    remote_connection.RemoteConnection object. Defaults to 'http://127.0.0.1:4444/wd/hub'.
keep_alive : bool (Deprecated)
    - Whether to configure remote_connection.RemoteConnection to use HTTP keep-alive. Defaults to True.
file_detector : object or None
    - Pass a custom file detector object during instantiation. If None, the default LocalFileDetector() will be used.
options : options.Options
    - Instance of a driver options.Options class.
locator_converter : object or None
    - Custom locator converter to use. Defaults to None.
web_element_cls : class
    - Custom class to use for web elements. Defaults to WebElement.
client_config : object or None
    - Custom client configuration to use. Defaults to None.
F)rA   rB   rC   rD   TN)rU   listrp   rb   _ignore_local_proxyrA   rV   bytesr^   
_is_remote
session_idr<   pinned_scriptsr#   error_handlerr,   
_switch_tor(   _mobiler&   r~   r'   r   _web_element_cls_authenticator_idstart_clientstart_sessionr$   _fedcm_websocket_connection_script)
selfrA   rB   r~   r_   r   r   rD   r6   r   s
             r3   __init__WebDriver.__init__   s%   @ gt$$)'2L"'"224L")"="= 0d++c5\::$9!1%#6+%D! 	 )^"4.d|*A.?.A!2!H6F6H / H43H3H!%<(Dk%)"r2   c                 z    S[        U 5      R                   S[        U 5      R                   SU R                   S3$ )N<.z (session="z")>)typeru   rt   r   r   s    r3   __repr__WebDriver.__repr__   s9    4:(()4:+>+>*?{4??J[[^__r2   c                     U $ Nr1   r   s    r3   	__enter__WebDriver.__enter__  s    r2   exc_typeexc	tracebackc                 $    U R                  5         g r   )quit)r   r   r   r   s       r3   __exit__WebDriver.__exit__  s     			r2   c              /      #    Sn[        U R                  U5      (       d  U R                  nU" U0 UD6U l         Sv   U(       a  X@l        gg! U(       a  X@l        f f = f7f)a  Overrides the current file detector (if necessary) in limited
context. Ensures the original file detector is set afterwards.

Parameters:
----------
file_detector_class : object
    - Class of the desired file detector. If the class is different
    from the current file_detector, then the class is instantiated with args and kwargs
    and used as a file detector during the duration of the context manager.
args : tuple
    - Optional arguments that get passed to the file detector class during instantiation.
kwargs : dict
    - Keyword arguments, passed the same way as args.

Example:
--------
>>> with webdriver.file_detector_context(UselessFileDetector):
>>>    someinput.send_keys('/etc/hosts')
N)rU   r~   )r   file_detector_classargskwargslast_detectors        r3   file_detector_contextWebDriver.file_detector_context  sa     * $,,.ABB ..M!4d!Ef!ED	3%2" }%2" s   7A A A AA c                     U R                   $ r   )r   r   s    r3   mobileWebDriver.mobile-  s    ||r2   c                 V    SU R                   ;   a  U R                   S   $ [        S5      e)zhReturns the name of the underlying browser for this instance.

Example:
--------
>>> name = driver.name
rM   z1browserName not specified in session capabilities)r<   KeyErrorr   s    r3   nameWebDriver.name1  s+     DII%99]++JKKr2   c                     g)zhCalled before starting a new session.

This method may be overridden to define custom startup behavior.
Nr1   r   s    r3   r   WebDriver.start_client=  s    
 	r2   c                     g)zjCalled after executing a quit command.

This method may be overridden to define custom shutdown
behavior.
Nr1   r   s    r3   stop_clientWebDriver.stop_clientD  s     	r2   r6   c                     [        U5      nU R                  [        R                  U5      S   nUR	                  S5      U l        UR	                  S5      U l        g)zCreates a new session with the desired capabilities.

Parameters:
----------
capabilities : dict
    - A capabilities dict to start the session with.
value	sessionIdr6   N)r@   executer"   NEW_SESSIONrO   r   r<   )r   r6   r<   responses       r3   r   WebDriver.start_sessionL  sI     L)<< 3 3T:7C",,{3LL0	r2   c                   ^  [        U[        5      (       a0  0 nUR                  5        H  u  p4T R                  U5      X#'   M     U$ [        UT R                  5      (       a  SUR
                  0$ [        UT R                  5      (       a  SUR
                  0$ [        U[        5      (       a  [        U 4S jU 5       5      $ U$ )N#element-6066-11e4-a52e-4f735466cecf"shadow-6066-11e4-a52e-4f735466cecfc              3   F   >#    U  H  nTR                  U5      v   M     g 7fr   )_wrap_valuerP   itemr   s     r3   rR   (WebDriver._wrap_value.<locals>.<genexpr>e  s     A54((..5   !)rU   dictr;   r   r   id_shadowroot_clsr   )r   r   	convertedkeyvals   `    r3   r   WebDriver._wrap_valueZ  s    eT""I!KKM!%!1!1#!6	 *eT22339588DDeT11228%((CCeT""A5AAAr2   
element_idc                 $    U R                  X5      $ )z6Creates a web element with the specified `element_id`.)r   )r   r   s     r3   create_web_elementWebDriver.create_web_elementh  s    $$T66r2   c                 L  ^  [        U[        5      (       ac  SU;   a  T R                  US   5      $ SU;   a  T R                  T US   5      $ UR	                  5        H  u  p#T R                  U5      X'   M     U$ [        U[        5      (       a  [        U 4S jU 5       5      $ U$ )Nr   r   c              3   F   >#    U  H  nTR                  U5      v   M     g 7fr   )_unwrap_valuer   s     r3   rR   *WebDriver._unwrap_value.<locals>.<genexpr>v  s     CUT**400Ur   )rU   r   r   r   r;   r   r   )r   r   r   r   s   `   r3   r   WebDriver._unwrap_valuel  s    eT""4=..u5Z/[\\3u<++D%8\2]^^!KKM!//4
 *LeT""CUCCCr2   cmdcmd_argsc                 0    U R                  SXS.5      S   $ )al  Execute Chrome Devtools Protocol command and get returned result The
command and command args should follow chrome devtools protocol
domains/commands, refer to link
https://chromedevtools.github.io/devtools-protocol/

Parameters:
----------
cmd : str,
    - Command name

cmd_args : dict
    - Command args
    - Empty dict {} if there is no command args

Returns:
--------
    A dict, empty dict {} if there is no result to return.
        - To getResponseBody: {'base64Encoded': False, 'body': 'response body string'}

Example:
--------
>>> driver.execute_cdp_cmd('Network.getResponseBody', {'requestId': requestId})

executeCdpCommand)r   paramsr   )r   )r   r   r   s      r3   execute_cdp_cmdWebDriver.execute_cdp_cmdy  s    2 ||/1QRSZ[[r2   driver_commandr   c                    U R                  U5      nU R                  (       a+  U(       d  SU R                  0nOSU;  a  U R                  US'   U R                  R                  X5      nU(       aA  U R                  R                  U5        U R                  UR                  SS5      5      US'   U$ SSU R                  S.$ )aI  Sends a command to be executed by a command.CommandExecutor.

Parameters:
----------
driver_command : str
    - The name of the command to execute as a string.

params : dict
    - A dictionary of named Parameters to send with the command.

Returns:
--------
  dict - The command's JSON response loaded into a dictionary object.
r   r   Nr   )successr   r   )r   r   rA   r   r   check_responser   rO   )r   r   r   r   s       r3   r   WebDriver.execute  s     !!&)??%t7F*&*oo{#((00H--h7 $ 2 28<<3N OHWO t$//JJr2   urlc                 H    U R                  [        R                  SU05        g)a  Navigate the browser to the specified URL in the current window or
tab.

The method does not return until the page is fully loaded (i.e. the
onload event has fired).

Parameters:
----------
url : str
    - The URL to be opened by the browser.
    - Must include the protocol (e.g., http://, https://).

Example:
--------
>>> driver = webdriver.Chrome()
>>> driver.get("https://example.com")
r   N)r   r"   GET)r   r   s     r3   rO   WebDriver.get  s    $ 	W[[5#,/r2   c                 `    U R                  [        R                  5      R                  SS5      $ )zReturns the title of the current page.

Example:
--------
>>> element = driver.find_element(By.ID, 'foo')
>>> print(element.title())
r    )r   r"   	GET_TITLErO   r   s    r3   titleWebDriver.title  s&     ||G--.227B??r2   scriptc                 L    [        U5      nXR                  UR                  '   U$ )zStore common javascript scripts to be executed later by a unique
hashable ID.

Example:
--------
>>> script = "return document.getElementById('foo').value"
)r*   r   r   )r   r   
script_keyscript_key_instances       r3   
pin_scriptWebDriver.pin_script  s*     (
36</223""r2   r   c                      U R                   R                  UR                  5        g! [         a    [        SU SU R                    35      Sef = f)zURemove a pinned script from storage.

Example:
--------
>>> driver.unpin(script_key)
zNo script with key: z existed in N)r   popr   r   )r   r   s     r3   unpinWebDriver.unpin  sT    	k##JMM2 	k1*\$J]J]I^_`fjj	ks	   %( 'Ac                 ,    [        U R                  5      $ )ziReturn a list of all pinned scripts.

Example:
--------
>>> pinned_scripts = driver.get_pinned_scripts()
)r   r   r   s    r3   get_pinned_scriptsWebDriver.get_pinned_scripts  s     D''((r2   c                     [        U[        5      (       a   U R                  UR                     n[        U5      n[        R                  nU R                  XAUS.5      S   $ ! [         a    [        S5      ef = f)a  Synchronously Executes JavaScript in the current window/frame.

Parameters:
----------
script : str
    - The javascript to execute.

*args : tuple
    - Any applicable arguments for your JavaScript.

Example:
--------
>>> input_id = "username"
>>> input_value = "test_user"
>>> driver.execute_script(
...     "document.getElementById(arguments[0]).value = arguments[1];", input_id, input_value
... )
z Pinned script could not be foundr   r   r   )
rU   r*   r   r   r   r   r   r"   W3C_EXECUTE_SCRIPTr   r   r   r   converted_argscommands        r3   execute_scriptWebDriver.execute_script  sz    & fi((N,,VYY7 d,,||G%OPQXYY  N)*LMMNs   A" "A8c                 f    [        U5      n[        R                  nU R                  XAUS.5      S   $ )a  Asynchronously Executes JavaScript in the current window/frame.

Parameters:
----------
script : str
    - The javascript to execute.

*args : tuple
    - Any applicable arguments for your JavaScript.

Example:
--------
>>> script = "var callback = arguments[arguments.length - 1]; "
...     "window.setTimeout(function(){ callback('timeout') }, 3000);"
>>> driver.execute_async_script(script)
r   r   )r   r"   W3C_EXECUTE_SCRIPT_ASYNCr   r   s        r3   execute_async_scriptWebDriver.execute_async_script  s2    " d22||G%OPQXYYr2   c                 F    U R                  [        R                  5      S   $ )zSGets the URL of the current page.

Example:
--------
>>> print(driver.current_url)
r   )r   r"   GET_CURRENT_URLr   s    r3   current_urlWebDriver.current_url(       ||G334W==r2   c                 F    U R                  [        R                  5      S   $ )zVGets the source of the current page.

Example:
--------
>>> print(driver.page_source)
r   )r   r"   GET_PAGE_SOURCEr   s    r3   page_sourceWebDriver.page_source2  r  r2   c                 B    U R                  [        R                  5        g)zACloses the current window.

Example:
--------
>>> driver.close()
N)r   r"   CLOSEr   s    r3   closeWebDriver.close<  s     	W]]#r2   c                      U R                  [        R                  5        U R                  5         U R                  R                  5         g! U R                  5         U R                  R                  5         f = f)zZQuits the driver and closes every associated window.

Example:
--------
>>> driver.quit()
N)r   r"   QUITr   rA   r  r   s    r3   r   WebDriver.quitE  sW    	*LL&!!'') !!'')s   A ,A8c                 F    U R                  [        R                  5      S   $ )zeReturns the handle of the current window.

Example:
--------
>>> print(driver.current_window_handle)
r   )r   r"   W3C_GET_CURRENT_WINDOW_HANDLEr   s    r3   current_window_handleWebDriver.current_window_handleR  s     ||GAAB7KKr2   c                 F    U R                  [        R                  5      S   $ )zsReturns the handles of all windows within the current session.

Example:
--------
>>> print(driver.window_handles)
r   )r   r"   W3C_GET_WINDOW_HANDLESr   s    r3   window_handlesWebDriver.window_handles\       ||G::;GDDr2   c                 H    [         R                  nU R                  US5        g)zfMaximizes the current window that webdriver is using.

Example:
--------
>>> driver.maximize_window()
N)r"   W3C_MAXIMIZE_WINDOWr   )r   r  s     r3   maximize_windowWebDriver.maximize_windowf  s     --Wd#r2   c                 B    U R                  [        R                  5        g)zoInvokes the window manager-specific 'full screen' operation.

Example:
--------
>>> driver.fullscreen_window()
N)r   r"   FULLSCREEN_WINDOWr   s    r3   fullscreen_windowWebDriver.fullscreen_windowp  s     	W../r2   c                 B    U R                  [        R                  5        g)z9Invokes the window manager-specific 'minimize' operation.N)r   r"   MINIMIZE_WINDOWr   s    r3   minimize_windowWebDriver.minimize_windowy  s    W,,-r2   print_optionsc                 z    0 nU(       a  UR                  5       nU R                  [        R                  U5      S   $ )zTakes PDF of the current page.

The driver makes a best effort to return a PDF based on the
provided Parameters.

Example:
--------
>>> driver.print_page()
r   )to_dictr   r"   
PRINT_PAGE)r   r-  r_   s      r3   
print_pageWebDriver.print_page}  s6     #++-G||G..8AAr2   c                     U R                   $ )a  Return an object containing all options to switch focus into.

Returns:
--------
SwitchTo: an object containing all options to switch focus into.

Examples:
--------
>>> element = driver.switch_to.active_element
>>> alert = driver.switch_to.alert
>>> driver.switch_to.default_content()
>>> driver.switch_to.frame('frame_name')
>>> driver.switch_to.frame(1)
>>> driver.switch_to.frame(driver.find_elements(By.TAG_NAME, "iframe")[0])
>>> driver.switch_to.parent_frame()
>>> driver.switch_to.window('main')
)r   r   s    r3   	switch_toWebDriver.switch_to  s    & r2   c                 B    U R                  [        R                  5        g)zTGoes one step backward in the browser history.

Example:
--------
>>> driver.back()
N)r   r"   GO_BACKr   s    r3   backWebDriver.back       	W__%r2   c                 B    U R                  [        R                  5        g)zVGoes one step forward in the browser history.

Example:
--------
>>> driver.forward()
N)r   r"   
GO_FORWARDr   s    r3   forwardWebDriver.forward  s     	W''(r2   c                 B    U R                  [        R                  5        g)zDRefreshes the current page.

Example:
--------
>>> driver.refresh()
N)r   r"   REFRESHr   s    r3   refreshWebDriver.refresh  r:  r2   c                 F    U R                  [        R                  5      S   $ )zReturns a set of dictionaries, corresponding to cookies visible in
the current session.

Returns:
--------
cookies:List[dict] : A list of dictionaries, corresponding to cookies visible in the current

Example:
--------
>>> cookies = driver.get_cookies()
r   )r   r"   GET_ALL_COOKIESr   s    r3   get_cookiesWebDriver.get_cookies  s     ||G334W==r2   c                    U(       a  UR                  5       (       a  [        S5      e[        R                  " [        5         U R                  [        R                  SU05      S   sSSS5        $ ! , (       d  f       g= f)zGet a single cookie by name. Raises ValueError if the name is empty
or whitespace. Returns the cookie if found, None if not.

Example:
--------
>>> cookie = driver.get_cookie('my_cookie')
Cookie name cannot be emptyr   r   N)isspace
ValueError
contextlibsuppressr   r   r"   
GET_COOKIEr   r   s     r3   
get_cookieWebDriver.get_cookie  sZ     t||~~:;;  !67<< 2 2VTNCGL 877 s   %A11
A?c                     U(       a  UR                  5       (       a  [        S5      eU R                  [        R                  SU05        g)zDeletes a single cookie with the given name. Raises ValueError if
the name is empty or whitespace.

Example:
--------
>>> driver.delete_cookie('my_cookie')
rH  r   N)rI  rJ  r   r"   DELETE_COOKIErN  s     r3   delete_cookieWebDriver.delete_cookie  s5     t||~~:;;W**VTN;r2   c                 B    U R                  [        R                  5        g)zcDelete all cookies in the scope of the session.

Example:
--------
>>> driver.delete_all_cookies()
N)r   r"   DELETE_ALL_COOKIESr   s    r3   delete_all_cookiesWebDriver.delete_all_cookies  s     	W//0r2   c                     SU;   a.  US   S;   d   eU R                  [        R                  SU05        gU R                  [        R                  SU05        g)a%  Adds a cookie to your current session.

Parameters:
----------
cookie_dict : dict
    - A dictionary object, with required keys - "name" and "value";
    - Optional keys - "path", "domain", "secure", "httpOnly", "expiry", "sameSite"

Examples:
--------
>>> driver.add_cookie({'name' : 'foo', 'value' : 'bar'})
>>> driver.add_cookie({'name' : 'foo', 'value' : 'bar', 'path' : '/'})
>>> driver.add_cookie({'name' : 'foo', 'value' : 'bar', 'path' : '/', 'secure' : True})
>>> driver.add_cookie({'name' : 'foo', 'value' : 'bar', 'sameSite' : 'Strict'})
sameSite)StrictLaxNonecookieN)r   r"   
ADD_COOKIE)r   cookie_dicts     r3   
add_cookieWebDriver.add_cookie  sR      $z*.GGGGLL++h-DELL++h-DEr2   time_to_waitc           	      r    U R                  [        R                  S[        [	        U5      S-  5      05        g)ap  Sets a sticky timeout to implicitly wait for an element to be found,
or a command to complete. This method only needs to be called one time
per session. To set the timeout for calls to execute_async_script, see
set_script_timeout.

Parameters:
----------
time_to_wait : float
    - Amount of time to wait (in seconds)

Example:
--------
>>> driver.implicitly_wait(30)
implicit  Nr   r"   SET_TIMEOUTSintfloatr   rc  s     r3   implicitly_waitWebDriver.implicitly_wait  s-     	W))JE,<ORV<V8W+XYr2   c           	      r    U R                  [        R                  S[        [	        U5      S-  5      05        g)a   Set the amount of time that the script should wait during an
execute_async_script call before throwing an error.

Parameters:
---------
time_to_wait : float
    - The amount of time to wait (in seconds)

Example:
--------
>>> driver.set_script_timeout(30)
r   rf  Nrg  rk  s     r3   set_script_timeoutWebDriver.set_script_timeout  s-     	W))Hc%:MPT:T6U+VWr2   c           	           U R                  [        R                  S[        [	        U5      S-  5      05        g! [
         a2    U R                  [        R                  [	        U5      S-  SS.5         gf = f)zSet the amount of time to wait for a page load to complete before
throwing an error.

Parameters:
 ---------
 time_to_wait : float
     - The amount of time to wait (in seconds)

 Example:
 --------
 >>> driver.set_page_load_timeout(30)
pageLoadrf  z	page load)msr   N)r   r"   rh  ri  rj  r   rk  s     r3   set_page_load_timeoutWebDriver.set_page_load_timeout,  sf    	hLL--
Cl@SVZ@Z<[/\]! 	hLL--eL6ID6PZe/fg	hs   7: 9A65A6c                     U R                  [        R                  5      S   nUR                  S5      S-  US'   UR                  S5      S-  US'   UR                  S5      S-  US'   [	        S0 UD6$ )	aZ  Get all the timeouts that have been set on the current session.

Returns:
--------
Timeouts: A named tuple with the following fields:
    - implicit_wait: The time to wait for elements to be found.
    - page_load: The time to wait for a page to load.
    - script: The time to wait for scripts to execute.

Example:
--------
>>> driver.timeouts
r   re  rf  implicit_waitrr  	page_loadr   r1   )r   r"   GET_TIMEOUTSr   r   )r   timeoutss     r3   rz  WebDriver.timeouts>  ss     << 4 45g>$,LL$<t$C! (Z 84 ?%\\(3d:#(##r2   c                 f    U R                  [        R                  UR                  5       5      S   ng)zSet all timeouts for the session. This will override any previously
set timeouts.

Example:
--------
>>> my_timeouts = Timeouts()
>>> my_timeouts.implicit_wait = 10
>>> driver.timeouts = my_timeouts
r   N)r   r"   rh  _to_json)r   rz  _s      r3   rz  r{  S  s(     LL--x/@/@/BCGLr2   r   c                    U R                   R                  X5      u  p[        U[        5      (       a3  U R	                  XS9nU(       d  [        SUR                   35      eUS   $ U R                  [        R                  XS.5      S   $ )aL  Find an element given a By strategy and locator.

Parameters:
----------
by : selenium.webdriver.common.by.By
    The locating strategy to use. Default is `By.ID`. Supported values include:
    - By.ID: Locate by element ID.
    - By.NAME: Locate by the `name` attribute.
    - By.XPATH: Locate by an XPath expression.
    - By.CSS_SELECTOR: Locate by a CSS selector.
    - By.CLASS_NAME: Locate by the `class` attribute.
    - By.TAG_NAME: Locate by the tag name (e.g., "input", "button").
    - By.LINK_TEXT: Locate a link element by its exact text.
    - By.PARTIAL_LINK_TEXT: Locate a link element by partial text match.
    - RelativeBy: Locate elements relative to a specified root element.

Example:
--------
element = driver.find_element(By.ID, 'foo')

Returns:
-------
WebElement
    The first matching `WebElement` found on the page.
)byr   z%Cannot locate relative element with: r   usingr   r   )
r   convertrU   r   find_elementsr   rootr   r"   FIND_ELEMENT)r   r  r   elementss       r3   find_elementWebDriver.find_element`  s    4 **222=	b*%%))R)=H,/TUWU\U\T]-^__A;||G00B2OPQXYYr2   c                    U R                   R                  X5      u  p[        U[        5      (       ar  SR	                  [
        R                  S5      SS 5      n[        R                  " US5      R                  S5      nSU S3nU R                  XQR                  5       5      $ U R                  [        R                  XS.5      S	   =(       d    / $ )
aZ  Find elements given a By strategy and locator.

Parameters:
----------
by : selenium.webdriver.common.by.By
    The locating strategy to use. Default is `By.ID`. Supported values include:
    - By.ID: Locate by element ID.
    - By.NAME: Locate by the `name` attribute.
    - By.XPATH: Locate by an XPath expression.
    - By.CSS_SELECTOR: Locate by a CSS selector.
    - By.CLASS_NAME: Locate by the `class` attribute.
    - By.TAG_NAME: Locate by the tag name (e.g., "input", "button").
    - By.LINK_TEXT: Locate a link element by its exact text.
    - By.PARTIAL_LINK_TEXT: Locate a link element by partial text match.
    - RelativeBy: Locate elements relative to a specified root element.

Example:
--------
element = driver.find_element(By.ID, 'foo')

Returns:
-------
WebElement
    list of `WebElements` matching locator strategy found on the page.
r   NzfindElements.jsutf8z/* findElements */return (z).apply(null, arguments);r  r   )r   r  rU   r   joinrt   splitpkgutilget_datadecoder  r/  r   r"   FIND_ELEMENTS)r   r  r   _pkgraw_functionfind_element_jss         r3   r  WebDriver.find_elements  s    4 **222=	b*%%88HNN3/45D"++D2CDKKFSL :<.HabO&&

EE ||G11R3PQRYZ`^``r2   c                     U R                   $ )zgReturns the drivers current capabilities being used.

Example:
--------
>>> print(driver.capabilities)
)r<   r   s    r3   r6   WebDriver.capabilities  s     yyr2   c                 R   [        U5      R                  5       R                  S5      (       d  [        R                  " S[
        SS9  U R                  5       n [        US5       nUR                  U5        SSS5        Ag! , (       d  f       N= f! [         a     Agf = f! Af = f)	au  Saves a screenshot of the current window to a PNG image file.
Returns False if there is any IOError, else returns True. Use full
paths in your filename.

Parameters:
----------
filename : str
    - The full path you wish to save your screenshot to. This
    - should end with a `.png` extension.

Example:
--------
>>> driver.get_screenshot_as_file('/Screenshots/foo.png')
z.pngz^name used for saved screenshot does not match file type. It should end with a `.png` extensionr   
stacklevelwbNFT)
rV   lowerendswithwarningswarnUserWarningget_screenshot_as_pngopenwriteOSError)r   filenamepngfs       r3   get_screenshot_as_file WebDriver.get_screenshot_as_file  s     8}""$--f55MMp
 ((*	h% &
  &% 		 sH   B %B7B 
BB B# B 
B B# B  B# #B&c                 $    U R                  U5      $ )an  Saves a screenshot of the current window to a PNG image file.
Returns False if there is any IOError, else returns True. Use full
paths in your filename.

Parameters:
----------
filename : str
    - The full path you wish to save your screenshot to. This
    - should end with a `.png` extension.

Example:
--------
>>> driver.save_screenshot('/Screenshots/foo.png')
)r  )r   r  s     r3   save_screenshotWebDriver.save_screenshot  s     **844r2   c                 R    [        U R                  5       R                  S5      5      $ )zrGets the screenshot of the current window as a binary data.

Example:
--------
>>> driver.get_screenshot_as_png()
ascii)r   get_screenshot_as_base64encoder   s    r3   r  WebDriver.get_screenshot_as_png  s#     668??HIIr2   c                 F    U R                  [        R                  5      S   $ )zGets the screenshot of the current window as a base64 encoded string
which is useful in embedded images in HTML.

Example:
--------
>>> driver.get_screenshot_as_base64()
r   )r   r"   
SCREENSHOTr   s    r3   r  "WebDriver.get_screenshot_as_base64  s     ||G../88r2   windowHandlec                 j    U R                  U5        U R                  [        U5      [        U5      S9  g)a  Sets the width and height of the current window. (window.resizeTo)

Parameters:
----------
width : int
    - the width in pixels to set the window to

height : int
    - the height in pixels to set the window to

Example:
--------
>>> driver.set_window_size(800,600)
widthheightN"_check_if_window_handle_is_currentset_window_rectri  )r   r  r  r  s       r3   set_window_sizeWebDriver.set_window_size  s-     	//=3u:c&kBr2   c                     U R                  U5        U R                  5       nUR                  SS5      (       a  US   nS Vs0 s H  o3X#   _M	     sn$ s  snf )zaGets the width and height of the current window.

Example:
--------
>>> driver.get_window_size()
r   Nr  )r  get_window_rectrO   )r   r  sizer>   s       r3   get_window_sizeWebDriver.get_window_size	  sX     	//=##%88GT""=D$78$7q47
$7888s   Axyc                 h    U R                  U5        U R                  [        U5      [        U5      S9$ )a  Sets the x,y position of the current window. (window.moveTo)

Parameters:
---------
x : float
    - The x-coordinate in pixels to set the window position

y : float
    - The y-coordinate in pixels to set the window position

Example:
--------
>>> driver.set_window_position(0,0)
r  r  r  )r   r  r  r  s       r3   set_window_positionWebDriver.set_window_position  s0     	//=##c!fA#77r2   c                 x    U R                  U5        U R                  5       nS Vs0 s H  o3X#   _M	     sn$ s  snf )zaGets the x,y position of the current window.

Example:
--------
>>> driver.get_window_position()
r  )r  r  )r   r  positionr>   s       r3   get_window_positionWebDriver.get_window_position+  s<     	//='')(23
18;
333s   7c                 <    US:w  a  [         R                  " SSS9  gg)z5Warns if the window handle is not equal to `current`.currentz?Only 'current' window is supported for W3C compatible browsers.r   r  N)r  r  )r   r  s     r3   r  ,WebDriver._check_if_window_handle_is_current8  s    9$MM[hij %r2   c                 F    U R                  [        R                  5      S   $ )zGets the x, y coordinates of the window as well as height and width
of the current window.

Example:
--------
>>> driver.get_window_rect()
r   )r   r"   GET_WINDOW_RECTr   s    r3   r  WebDriver.get_window_rect=  r  r2   c                     Uc  Uc  U(       d  U(       d  [        S5      eU R                  [        R                  XX4S.5      S   $ )a  Sets the x, y coordinates of the window as well as height and width
of the current window. This method is only supported for W3C compatible
browsers; other browsers should use `set_window_position` and
`set_window_size`.

Example:
--------
>>> driver.set_window_rect(x=10, y=10)
>>> driver.set_window_rect(width=100, height=200)
>>> driver.set_window_rect(x=10, y=10, width=100, height=200)
z'x and y or height and width need values)r  r  r  r  r   )r   r   r"   SET_WINDOW_RECT)r   r  r  r  r  s        r3   r  WebDriver.set_window_rectG  s?     I!)fU*+TUU||G331u5ghipqqr2   c                     U R                   $ r   )_file_detectorr   s    r3   r~   WebDriver.file_detectorY  s    """r2   c                 t    U(       d  [        S5      e[        U[        5      (       d  [        S5      eXl        g)a  Set the file detector to be used when sending keyboard input. By
default, this is set to a file detector that does nothing.

- see FileDetector
- see LocalFileDetector
- see UselessFileDetector

Parameters:
----------
detector : Any
    - The detector to use. Must not be None.
z,You may not set a file detector that is nullz+Detector has to be instance of FileDetectorN)r   rU   r%   r  )r   detectors     r3   r~   r  ]  s2     $%STT(L11$%RSS&r2   c                 F    U R                  [        R                  5      S   $ )zdGets the current orientation of the device.

Example:
--------
>>> orientation = driver.orientation
r   )r   r"   GET_SCREEN_ORIENTATIONr   s    r3   orientationWebDriver.orientationq  r   r2   c                     SS/nUR                  5       U;   a#  U R                  [        R                  SU05        g[	        S5      e)zSets the current orientation of the device.

Parameters:
----------
value : str
    - orientation to set it to.

Example:
--------
>>> driver.orientation = 'landscape'
	LANDSCAPEPORTRAITr  z>You can only set the orientation to 'LANDSCAPE' and 'PORTRAIT'N)upperr   r"   SET_SCREEN_ORIENTATIONr   )r   r   allowed_valuess      r3   r  r  {  sA     &z2;;=N*LL77-9OP$%effr2   c                 F    U R                  [        R                  5      S   $ )z}Gets a list of the available log types. This only works with w3c
compliant browsers.

Example:
--------
>>> driver.log_types
r   )r   r"   GET_AVAILABLE_LOG_TYPESr   s    r3   	log_typesWebDriver.log_types  s     ||G;;<WEEr2   c                 L    U R                  [        R                  SU05      S   $ )a   Gets the log for a given log type.

Parameters:
----------
log_type : str
    - Type of log that which will be returned

Example:
--------
>>> driver.get_log('browser')
>>> driver.get_log('driver')
>>> driver.get_log('client')
>>> driver.get_log('server')
r   r   )r   r"   GET_LOG)r   log_types     r3   get_logWebDriver.get_log  s#     ||GOOfh-?@IIr2   c                 p   U R                   (       a  [        U R                   4$ [        5         [        (       d  U R                  R	                  S5      (       aI  U R                  R	                  S5      nU R                  R	                  S5      R                  S5      S   nOU R                  5       u  p!U(       d  [        S5      e[        R                  U5      qU R                  S   R                  5       S:X  a  [        S5      e[        W5      U l         U R                   R                  [        R                  R                  5       5      nUS   R                   nU R                   R                  [        R                  R#                  US	5      5      nXPR                   l        [        U R                   4$ )
Nse:cdpse:cdpVersionr   r   2Unable to find url to connect to from capabilitiesrM   firefoxzJCDP support for Firefox has been removed. Please switch to WebDriver BiDi.T)r   devtoolsr4   r<   rO   r  _get_cdp_detailsr   r0   import_devtoolsr  RuntimeErrorr.   r   targetget_targets	target_idattach_to_targetr   )r   ws_urlversiontargetsr  sessions         r3   start_devtoolsWebDriver.start_devtools  sI   %%T7777 L899==**!YY]]84F"iimmO<BB3GJG&*&;&;&=OG,-abb..w799]+113y@&'stt)<V)DD&00889T9T9VWG
,,I00889Y9YZcei9jkG4;&&1T7777r2   c                8  #    [        5         U R                  R                  S5      (       aI  U R                  R                  S5      nU R                  R                  S5      R                  S5      S   nOU R	                  5       u  p!U(       d  [        S5      e[        R                  U5      n[        R                  U5       IS h  vN nUR                  UR                  R                  5       5      I S h  vN nUS   R                  nUR                  U5       IS h  vN n[        U[        U5      7v   S S S 5      IS h  vN   S S S 5      IS h  vN   g  N Nd N= N! , IS h  vN  (       d  f       N0= f N'! , IS h  vN  (       d  f       g = f7f)Nr  r  r   r   r  )r4   r<   rO   r  r  r   r0   r  open_cdpr   r  r  r  open_sessionr    )r   r  r  r  connr  r  r   s           r3   bidi_connectionWebDriver.bidi_connection  s     	99==""YY]]8,FiimmO4::3?BG"335OG$%YZZ&&w/<<''4 LL)D)D)FGGG
,,I((33w$Wc8<< 43 (''G3333 ('''s   CFE	F-F 9E:(F "E #F &E$;F E"F FE>FF  F "F $E;	*E-+E;	7F >F FF	FFc                     U R                   (       d  U R                  5         U R                  (       d  [        U R                   5      U l        U R                  $ r   )r   _start_bidir   r   r   s    r3   r   WebDriver.script  s:    ))||!$"<"<=DL||r2   c                     U R                   R                  S5      (       a  U R                   R                  S5      nO[        S5      e[        U5      U l        g )NwebSocketUrlr  )r<   rO   r   r.   r   )r   r  s     r3   r
  WebDriver._start_bidi  s@    99==((YY]]>2F$%YZZ%8%@"r2   c                 N   SS K nSS KnUR                  5       nU R                  R	                  S5      S:X  a+  U R                  R	                  S5      R	                  S5      nOIU R                  R	                  S5      S:X  a*  U R                  R	                  S5      R	                  S5      nUR                  SS	W S
35      nUR                  UR                  5      nUR	                  S5      nUR	                  S5      nSS Kn	U	R                  SU5      R                  S5      n
X4$ )Nr   rM   chromezgoog:chromeOptionsdebuggerAddressMicrosoftEdgezms:edgeOptionsr   zhttp://z/json/versionBrowserwebSocketDebuggerUrlz
.*/(\d+)\.r   )jsonurllib3PoolManagerr<   rO   requestloadsdataresearchgroup)r   r  r  httpdebugger_addressresr  browser_versionwebsocket_urlr  r  s              r3   r  WebDriver._get_cdp_details  s    ""$99=='83#yy}}-ABFFGXYYY]]=)_<#yy}}-=>BBCTUll5G,<+=]"KLzz#((#((9-!78))M?;AA!D%%r2   c                 p    U R                  [        R                  UR                  5       5      S   U l        g)a6  Adds a virtual authenticator with the given options.

Example:
--------
>>> from selenium.webdriver.common.virtual_authenticator import VirtualAuthenticatorOptions
>>> options = VirtualAuthenticatorOptions(protocol="u2f", transport="usb", device_id="myDevice123")
>>> driver.add_virtual_authenticator(options)
r   N)r   r"   ADD_VIRTUAL_AUTHENTICATORr/  r   )r   r_   s     r3   add_virtual_authenticator#WebDriver.add_virtual_authenticator  s-     "&g.O.OQXQ`Q`Qb!cdk!lr2   c                     U R                   $ )zkReturns the id of the virtual authenticator.

Example:
--------
>>> print(driver.virtual_authenticator_id)
)r   r   s    r3   virtual_authenticator_id"WebDriver.virtual_authenticator_id  s     %%%r2   c                 j    U R                  [        R                  SU R                  05        SU l        g)zRemoves a previously added virtual authenticator.

The authenticator is no longer valid after removal, so no
methods may be called.

Example:
--------
>>> driver.remove_virtual_authenticator()
authenticatorIdN)r   r"   REMOVE_VIRTUAL_AUTHENTICATORr   r   s    r3   remove_virtual_authenticator&WebDriver.remove_virtual_authenticator  s,     	W99<MtOeOe;fg!%r2   
credentialc                     U R                  [        R                  0 UR                  5       ESU R                  0E5        g)zInjects a credential into the authenticator.

Example:
--------
>>> from selenium.webdriver.common.credential import Credential
>>> credential = Credential(id="user@example.com", password="aPassword")
>>> driver.add_credential(credential)
r,  N)r   r"   ADD_CREDENTIALr/  r   )r   r0  s     r3   add_credentialWebDriver.add_credential'  s6     	W++-p
0B0B0D-pFWY]YoYo-pqr2   c                     U R                  [        R                  SU R                  05      nUS    Vs/ s H  n[        R
                  " U5      PM     sn$ s  snf )zzReturns the list of credentials owned by the authenticator.

Example:
--------
>>> credentials = driver.get_credentials()
r,  r   )r   r"   GET_CREDENTIALSr   r   	from_dict)r   credential_datar0  s      r3   get_credentialsWebDriver.get_credentials3  sR     ,,w'>'>ARTXTjTj@klCRSZC[\C[Z
$$Z0C[\\\s    Acredential_idc                     [        U[        5      (       a  [        U5      R                  5       nU R	                  [
        R                  XR                  S.5        g)zRemoves a credential from the authenticator.

Example:
--------
>>> credential_id = "user@example.com"
>>> driver.remove_credential(credential_id)
)credentialIdr,  N)rU   	bytearrayr   r  r   r"   REMOVE_CREDENTIALr   )r   r;  s     r3   remove_credentialWebDriver.remove_credential>  sD     mY//-m<CCEM%%ZpZp'q	
r2   c                 \    U R                  [        R                  SU R                  05        g)zgRemoves all credentials from the authenticator.

Example:
--------
>>> driver.remove_all_credentials()
r,  N)r   r"   REMOVE_ALL_CREDENTIALSr   r   s    r3   remove_all_credentials WebDriver.remove_all_credentialsO  s$     	W336GI_I_5`ar2   verifiedc                 ^    U R                  [        R                  U R                  US.5        g)zSets whether the authenticator will simulate success or fail on user
verification.

Parameters:
----------
verified: True if the authenticator will pass user verification, False otherwise.

Example:
--------
>>> driver.set_user_verified(True)
)r,  isUserVerifiedN)r   r"   SET_USER_VERIFIEDr   )r   rF  s     r3   set_user_verifiedWebDriver.set_user_verifiedY  s$     	W..DDZDZnv0wxr2   c                     SU R                   ;  a  [        S5      eU R                  [        R                  5      S   S   $ )zyRetrieves the downloadable files as a list of file names.

Example:
--------
>>> files = driver.get_downloadable_files()
se:downloadsEnabledCYou must enable downloads in order to work with downloadable files.r   names)r6   r   r   r"   GET_DOWNLOADABLE_FILESr   s    r3   get_downloadable_files WebDriver.get_downloadable_filesh  s=     !(9(99$%jkk||G::;GDWMMr2   	file_nametarget_directoryc                    SU R                   ;  a  [        S5      e[        R                  R	                  U5      (       d  [        R
                  " U5        U R                  [        R                  SU05      S   S   n[        R                  " 5        n[        R                  R                  XAS-   5      n[        US5       nUR                  [        R                  " U5      5        SSS5        [         R"                  " US	5       nUR%                  U5        SSS5        SSS5        g! , (       d  f       NH= f! , (       d  f       N(= f! , (       d  f       g= f)
a=  Downloads a file with the specified file name to the target
directory.

Parameters:
----------
file_name : str
    - The name of the file to download.

target_directory : str
    - The path to the directory to save the downloaded file.

Example:
--------
>>> driver.download_file("example.zip", "/path/to/directory")
rM  rN  r   r   contentsz.zipr  Nr)r6   r   ospathexistsmakedirsr   r"   DOWNLOAD_FILEtempfileTemporaryDirectoryr  r  r  base64r   zipfileZipFile
extractall)r   rS  rT  rV  tmp_dirzip_filefilezip_refs           r3   download_fileWebDriver.download_filet  s      !(9(99$%jkkww~~.//KK()<< 5 5	7JKGTU_`((*gww||G-?@Hh%

6++H56 & 3/7""#34 0 +*%% 0/ +*s<   /E&D*(ED;E*
D8	4E;
E		E
Ec                 x    SU R                   ;  a  [        S5      eU R                  [        R                  5        g)zZDeletes all downloadable files.

Example:
--------
>>> driver.delete_downloadable_files()
rM  rN  N)r6   r   r   r"   DELETE_DOWNLOADABLE_FILESr   s    r3   delete_downloadable_files#WebDriver.delete_downloadable_files  s0     !(9(99$%jkkW667r2   c                     U R                   $ )a.  Returns the Federated Credential Management (FedCM) dialog object
for interaction.

Returns:
-------
FedCM: an object providing access to all Federated Credential Management (FedCM) dialog commands.

Examples:
--------
>>> title = driver.fedcm.title
>>> subtitle = driver.fedcm.subtitle
>>> dialog_type = driver.fedcm.dialog_type
>>> accounts = driver.fedcm.account_list
>>> driver.fedcm.select_account(0)
>>> driver.fedcm.accept()
>>> driver.fedcm.dismiss()
>>> driver.fedcm.enable_delay()
>>> driver.fedcm.disable_delay()
>>> driver.fedcm.reset_cooldown()
)r   r   s    r3   fedcmWebDriver.fedcm  s    , {{r2   c                 V    U R                   R                  [        R                  S5      $ )zmReturns whether the browser supports FedCM capabilities.

Example:
--------
>>> print(driver.supports_fedcm)
F)r6   rO   r   FEDCM_CAPABILITYr   s    r3   supports_fedcmWebDriver.supports_fedcm  s#       $$Z%@%@%HHr2   c                 <    U R                   (       d  [        S5      eg)z.Raises an exception if FedCM is not supported.znThis browser does not support Federated Credential Management. Please ensure you're using a supported browser.N)rr  r   r   s    r3   _require_fedcm_support WebDriver._require_fedcm_support  s#    ""$B  #r2   c                 8    U R                  5         [        U 5      $ )z_Returns the FedCM dialog object for interaction.

Example:
--------
>>> dialog = driver.dialog
)ru  r   r   s    r3   dialogWebDriver.dialog  s     	##%d|r2   c                    ^ ^^ SSK Jm  SSKJn  T R	                  5         Uc  T4nUU 4S jmU" T XUS9nUR                  U4S j5      $ )a  Waits for and returns the FedCM dialog.

Parameters:
----------
timeout : int
    - How long to wait for the dialog

poll_frequency : floatHow
    - Frequently to poll

ignored_exceptions : Any
    - Exceptions to ignore while waiting

Returns:
-------
    The FedCM dialog object if found

Raises:
-------
    TimeoutException if dialog doesn't appear
    WebDriverException if FedCM not supported
r   )NoAlertPresentException)WebDriverWaitc                  ^   >  [        T5      n U R                  (       a  U $ S $ ! T a     g f = fr   )r   r   )rx  r{  r   s    r3   _check_fedcm,WebDriver.fedcm_dialog.<locals>._check_fedcm  s4    !'v6$6* s   # # ,,)poll_frequencyignored_exceptionsc                    > T" 5       $ r   r1   )r~  r~  s    r3   <lambda>(WebDriver.fedcm_dialog.<locals>.<lambda>  s    LNr2   )selenium.common.exceptionsr{  selenium.webdriver.support.waitr|  ru  until)r   timeoutr  r  r|  waitr{  r~  s   `     @@r3   fedcm_dialogWebDriver.fedcm_dialog  sM    . 	GA##%%"9!;	 T7^pqzz233r2   )r   r   r  r   r   r   r   r   r   r<   rA   r   r~   r   r   r   )zhttp://127.0.0.1:4444TNNNNNr   )rE   N)r  )NNNN)   g      ?N)rt   ru   rv   rw   rx   r-   r   r+   r   r   rV   r)   boolr   r%   r   r
   r'   r   r!   r   r   r   r   BaseExceptiontypesTracebackTyper   r   r   propertyr(   r   r   r   r   r   r   r   r   r   r   r   rO   r   r*   r   r   r   r  r  r
  r  r  r   r  r  r#  r'  r+  r   r1  r,   r4  r8  r=  rA  rE  r	   rO  rS  rW  ra  rj  rl  ro  rt  r   rz  setterr   IDr  r  r6   r  r  r   r  r  r  r  r  r  r  r  r  r~   r  r  r  r  r   r  r   r
  r  r   r&  r)  r   r.  r   r3  r9  r>  r@  rD  rJ  r   rQ  rg  rk  r$   rn  rr  ru  rx  r  ry   r1   r2   r3   r|   r|      s
    " O :Q04CG8<*.04?%5 56? ?  -	?
 %T+-> >?@? $$45? "$?  -? 
?B`4./ m$ E//0	 3 3<    	Lc 	L 	L1$ 14 17S 7Z 7\3 \$ \6Kc K4 K4 K@0s 0t 0( @s @ @
# 
#) 
#
k	 
kd 
k)DI )Z<Z3 Z, >S > > >S > >$* Ls L L ES	 E E$0.B(> B# B  8  *&)&>T$Z >(4.  <1F.ZE Zd Z"Xu X Xh% hD h$ $( $ $( __
M 
M !eeD "ZHSM "ZZ "ZH  "uuT $aXc] $ad:FV $aL d  $ >54 5"Ju J9# 9C3 Ct C$9C 9 9 8U 8u 8C 8X\ 8$4T 4ks kt k
> >r$ r$ #| # # ' '& E E g g$ F FJ"88 = =&  A&0	m1L 	mQU 	m &# & & $& $& $	r 	r 	r $	r $]j!1 ] $] $
uS)^/D 
 
 $
  $b $b $y$ y4 y $y
N 
N5s 5c 5d 5@
8 u  . I I I  '4r2   r|   r   )Yrx   r_  rK  r9   rX  r  r]  r  r  r`  abcr   r   r   r   r   	importlibr   typingr	   r
   r   r   r   r  r   r   r   r   r   %selenium.webdriver.common.bidi.scriptr   selenium.webdriver.common.byr   !selenium.webdriver.common.optionsr   r   ,selenium.webdriver.common.print_page_optionsr   "selenium.webdriver.common.timeoutsr   /selenium.webdriver.common.virtual_authenticatorr   r   r   +selenium.webdriver.support.relative_locatorr   common.fedcm.dialogr   r  r    rD   r!   r  r"   errorhandlerr#   rn  r$   r~   r%   r&   r   r'   r   r(   remote_connectionr)   r   r*   
shadowrootr+   r4  r,   
webelementr-   websocket_connectionr.   r0   r  r4   r@   r   rV   r  r^   rp   rr   r|   r1   r2   r3   <module>r     sC  " $    	        $ * % #      ? : < = 9 8 + 8 9 E 7 F W C ( + '  &  ' , /  / ! "  " 5
BO4 -1C!112  	
 L) 6D- $ Dg N4 N4r2   