
    +gU                        S SK J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qSqS r " S S\S9r  " S S\ 5      r!g)    )annotationsN)ABCMeta)	b64decode)encodebytes)md5)BytesIO)List)JavascriptException)WebDriverException)By)keys_to_typing   )Command)
ShadowRootc                     SR                  [        R                  S5      S S 5      n [        R                  " U S5      R                  S5      q[        R                  " U S5      R                  S5      qg )N.zgetAttribute.jsutf8zisDisplayed.js)join__name__splitpkgutilget_datadecodegetAttribute_jsisDisplayed_js)_pkgs    l/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/selenium/webdriver/remote/webelement.py_load_jsr   ,   s^     88HNN3',-D&&t->?FFvNO%%d,<=DDVLN    c                      \ rS rSrSrSrg)BaseWebElement4   zyAbstract Base Class for WebElement.

ABC's will allow custom types to be registered as a WebElement to
pass type checks.
 N)r   
__module____qualname____firstlineno____doc____static_attributes__r$   r    r   r"   r"   4   s     	r    r"   )	metaclassc                     \ rS rSrSrS'S jrS r\S(S j5       r\S(S j5       r	S'S jr
S'S jrS'S	 jrS)S
 jrS(S jrS*S jrS+S jrS+S jrS,S jr\S-S j5       rS+S jr\S.S j5       r\S.S j5       rS(S jr\S.S j5       r\S.S j5       r\S(S j5       r\S(S j5       r\S(S j5       r\S/S j5       rS+S jr\S 5       r\S(S j5       r S r!S r"S0S! jr#\$RJ                  S 4S1S" jjr&\$RJ                  S 4S2S# jjr'S3S$ jr(S% r)S&r*g )4
WebElement>   a  Represents a DOM element.

Generally, all interesting operations that interact with a document will be
performed through this interface.

All method calls will do a freshness check to ensure that the element
reference is still valid.  This essentially determines whether the
element is still attached to the DOM.  If this test fails, then an
``StaleElementReferenceException`` is thrown, and all future calls to this
instance will fail.
c                    Xl         X l        g N)_parent_id)selfparentid_s      r   __init__WebElement.__init__K   s    r    c           	         S[        U 5      R                   S[        U 5      R                   SU R                  R                   SU R
                   S3	$ )N<r   z (session="z", element="z")>)typer%   r   r0   
session_idr1   r2   s    r   __repr__WebElement.__repr__O   sN    4:(()4:+>+>*?{4<<KbKbJccoptpxpxoyy|}}r    c                F    U R                  [        R                  5      S   $ )zThis element's ``tagName`` property.

Returns:
--------
str : The tag name of the element.

Example:
--------
>>> element = driver.find_element(By.ID, 'foo')
value)_executer   GET_ELEMENT_TAG_NAMEr;   s    r   tag_nameWebElement.tag_nameR   s     }}W99:7CCr    c                F    U R                  [        R                  5      S   $ )zThe text of the element.

Returns:
--------
str : The text of the element.

Example:
--------
>>> element = driver.find_element(By.ID, 'foo')
>>> print(element.text)
r?   )r@   r   GET_ELEMENT_TEXTr;   s    r   textWebElement.text`   s     }}W556w??r    c                B    U R                  [        R                  5        g)zkClicks the element.

Example:
--------
>>> element = driver.find_element(By.ID, 'foo')
>>> element.click()
N)r@   r   CLICK_ELEMENTr;   s    r   clickWebElement.clicko        	g++,r    c                |    Sn U R                   R                  X5        g! [         a  n[        S5      UeSnAff = f)zfSubmits a form.

Example:
--------
>>> form = driver.find_element(By.NAME, 'login')
>>> form.submit()
a  /* submitForm */var form = arguments[0];
while (form.nodeName != "FORM" && form.parentNode) {
  form = form.parentNode;
}
if (!form) { throw Error('Unable to find containing form element'); }
if (!form.ownerDocument) { throw Error('Unable to find owning document'); }
var e = form.ownerDocument.createEvent('Event');
e.initEvent('submit', true, true);
if (form.dispatchEvent(e)) { HTMLFormElement.prototype.submit.call(form) }
z=To submit an element, it must be nested inside a form elementN)r0   execute_scriptr
   r   )r2   scriptexcs      r   submitWebElement.submity   sF    [ 		oLL''5" 	o$%deknn	os     
;6;c                B    U R                  [        R                  5        g)zClears the text if it's a text entry element.

Example:
--------
>>> text_field = driver.find_element(By.NAME, 'username')
>>> text_field.clear()
N)r@   r   CLEAR_ELEMENTr;   s    r   clearWebElement.clear   rL   r    c                     U R                  [        R                  SU05      S   $ ! [         a    U R                  R                  SX5      s $ f = f)a  Gets the given property of the element.

Parameters:
----------
name : str
    - Name of the property to retrieve.

Returns:
-------
str | bool | WebElement | dict : The value of the property.

Example:
-------
>>> text_length = target_element.get_property("text_length")
namer?   z!return arguments[0][arguments[1]])r@   r   GET_ELEMENT_PROPERTYr   r3   rN   r2   rX   s     r   get_propertyWebElement.get_property   sR     	_==!=!=~NwWW! 	_;;--.QSW^^	_s   $' &AAc                L    U R                  [        R                  SU05      S   $ )a  Gets the given attribute of the element. Unlike
:func:`~selenium.webdriver.remote.BaseWebElement.get_attribute`, this
method only returns attributes declared in the element's HTML markup.

Parameters:
----------
name : str
    - Name of the attribute to retrieve.

Returns:
-------
str : The value of the attribute.

Example:
-------
>>> text_length = target_element.get_dom_attribute("class")
rX   r?   )r@   r   GET_ELEMENT_ATTRIBUTErZ   s     r   get_dom_attributeWebElement.get_dom_attribute   s$    $ }}W::VTNKGTTr    c                p    [         c
  [        5         U R                  R                  S[          S3X5      nU$ )a  Gets the given attribute or property of the element.

This method will first try to return the value of a property with the
given name. If a property with that name doesn't exist, it returns the
value of the attribute with the same name. If there's no attribute with
that name, ``None`` is returned.

Values which are considered truthy, that is equals "true" or "false",
are returned as booleans.  All other non-``None`` values are returned
as strings.  For attributes or properties which do not exist, ``None``
is returned.

To obtain the exact value of the attribute or property,
use :func:`~selenium.webdriver.remote.BaseWebElement.get_dom_attribute` or
:func:`~selenium.webdriver.remote.BaseWebElement.get_property` methods respectively.

Parameters:
----------
name : str
    - Name of the attribute/property to retrieve.

Returns:
-------
str | bool | None : The value of the attribute/property.

Example:
--------
>>> # Check if the "active" CSS class is applied to an element.
>>> is_active = "active" in target_element.get_attribute("class")
z/* getAttribute */return ().apply(null, arguments);)r   r   r3   rN   )r2   rX   attribute_values      r   get_attributeWebElement.get_attribute   s<    > "J++44((99RSUY
 r    c                F    U R                  [        R                  5      S   $ )zReturns whether the element is selected.

Example:
--------
>>> is_selected = element.is_selected()

Notes:
------
    - This method is generally used on checkboxes, options in a select
    and radio buttons.
r?   )r@   r   IS_ELEMENT_SELECTEDr;   s    r   is_selectedWebElement.is_selected   s     }}W889'BBr    c                F    U R                  [        R                  5      S   $ )zaReturns whether the element is enabled.

Example:
--------
>>> is_enabled = element.is_enabled()
r?   )r@   r   IS_ELEMENT_ENABLEDr;   s    r   
is_enabledWebElement.is_enabled   s     }}W778AAr    c                  ^  T R                   R                  (       a  [        [        U 4S jSR	                  [        [
        U5      5      R                  S5      5      5      nSU;  aE  / nU H#  nUR                  T R                  U5      5        M%     [        SR	                  U5      5      nT R                  [        R                  SR	                  [        U5      5      [        U5      S.5        g)a  Simulates typing into the element.

Parameters:
----------
value : str
    - A string for typing, or setting form fields.  For setting
    file inputs, this could be a local file path.

Notes:
------
    - Use this to send simple key events or to fill out form fields
    - This can also be used to set file inputs.

Examples:
--------
To send a simple key event::
>>> form_textfield = driver.find_element(By.NAME, 'username')
>>> form_textfield.send_keys("admin")

or to set a file input field::
>>> file_input = driver.find_element(By.NAME, 'profilePic')
>>> file_input.send_keys("path/to/profilepic.gif")
>>> # Generally it's better to wrap the file path in one of the methods
>>> # in os.path to return the actual path to support cross OS testing.
>>> # file_input.send_keys(os.path.abspath("path/to/profilepic.gif"))
>>> # When using Cygwin, the path need to be provided in Windows format.
>>> # file_input.send_keys(f"C:/cygwin{os.path.abspath('path/to/profilepic.gif').replace('/', '\')}")
c                `   > TR                   R                  R                  [        U 5      5      $ r/   )r3   file_detectoris_local_filestr)keys_to_sendr2   s    r   <lambda>&WebElement.send_keys.<locals>.<lambda>%  s!    )B)B)P)PQTUaQb)cr     
N)rF   r?   )r3   
_is_remotelistmapr   rr   r   append_uploadtupler@   r   SEND_KEYS_TO_ELEMENTr   )r2   r?   local_filesremote_filesfiles   `    r   	send_keysWebElement.send_keys  s    > ;;!!cGGCUO,2248K ;&!'D ''T(:; (dii56((277>%;P3Q\jkp\q*r	
r    c                F    U R                  [        R                  5      S   $ )a  Returns a shadow root of the element if there is one or an error.
Only works from Chromium 96, Firefox 96, and Safari 16.4 onwards.

Returns:
-------
ShadowRoot : object

Raises:
-------
NoSuchShadowRoot - if no shadow root was attached to element

Example:
--------
>>> try:
...     shadow_root = element.shadow_root
>>> except NoSuchShadowRoot:
...     print("No shadow root attached to element")
r?   )r@   r   GET_SHADOW_ROOTr;   s    r   shadow_rootWebElement.shadow_root3  s    ( }}W445g>>r    c                l    [         c
  [        5         U R                  R                  S[          S3U 5      $ )zgWhether the element is visible to a user.

Example:
--------
>>> is_displayed = element.is_displayed()
z/* isDisplayed */return (rb   )r   r   r3   rN   r;   s    r   is_displayedWebElement.is_displayedJ  s3     !J{{)),EnEUUn*oquvvr    c                    U R                  [        R                  SU /S.5      S   n[        US   5      [        US   5      S.$ )a  THIS PROPERTY MAY CHANGE WITHOUT WARNING. Use this to discover where
on the screen an element is so that we can click it. This method should
cause the element to be scrolled into view.

Returns:
--------
dict: the top lefthand corner location on the screen, or zero
    coordinates if the element is not visible.

Example:
--------
>>> loc = element.location_once_scrolled_into_view
zNarguments[0].scrollIntoView(true); return arguments[0].getBoundingClientRect())rO   argsr?   xyr   r   )r@   r   W3C_EXECUTE_SCRIPTround)r2   old_locs     r    location_once_scrolled_into_view+WebElement.location_once_scrolled_into_viewV  sQ     --&&j
  73<(uWS\/BCCr    c                `    U R                  [        R                  5      S   nUS   US   S.nU$ )zThe size of the element.

Returns:
--------
dict: The width and height of the element.

Example:
--------
>>> size = element.size
r?   heightwidth)r   r   r@   r   GET_ELEMENT_RECT)r2   sizenew_sizes      r   r   WebElement.sizen  s4     }}W556w?"8ntG}Er    c                L    U R                  [        R                  SU05      S   $ )zThe value of a CSS property.

Parameters:
----------
property_name : str
    - The name of the CSS property to get the value of.

Returns:
--------
str : The value of the CSS property.

Example:
--------
>>> value = element.value_of_css_property('color')
propertyNamer?   )r@   r   !GET_ELEMENT_VALUE_OF_CSS_PROPERTY)r2   property_names     r   value_of_css_property WebElement.value_of_css_property~  s'      }}WFFYfHghipqqr    c                    U R                  [        R                  5      S   n[        US   5      [        US   5      S.nU$ )zThe location of the element in the renderable canvas.

Returns:
--------
dict: The x and y coordinates of the element.

Example:
--------
>>> loc = element.location
r?   r   r   r   )r@   r   r   r   )r2   r   new_locs      r   locationWebElement.location  s>     -- 8 89'Bgcl+%2EFr    c                F    U R                  [        R                  5      S   $ )zA dictionary with the size and location of the element.

Returns:
--------
dict: The size and location of the element.

Example:
--------
>>> rect = element.rect
r?   r   r;   s    r   rectWebElement.rect  s     }}W556w??r    c                F    U R                  [        R                  5      S   $ )zReturns the ARIA role of the current web element.

Returns:
--------
str : The ARIA role of the element.

Example:
--------
>>> role = element.aria_role
r?   )r@   r   GET_ELEMENT_ARIA_ROLEr;   s    r   	aria_roleWebElement.aria_role  s     }}W::;GDDr    c                F    U R                  [        R                  5      S   $ )zReturns the ARIA Level of the current webelement.

Returns:
--------
str : The ARIA Level of the element.

Example:
--------
>>> name = element.accessible_name
r?   )r@   r   GET_ELEMENT_ARIA_LABELr;   s    r   accessible_nameWebElement.accessible_name  s     }}W;;<WEEr    c                F    U R                  [        R                  5      S   $ )zGets the screenshot of the current element as a base64 encoded
string.

Returns:
--------
str : The screenshot of the element as a base64 encoded string.

Example:
--------
>>> img_b64 = element.screenshot_as_base64
r?   )r@   r   ELEMENT_SCREENSHOTr;   s    r   screenshot_as_base64WebElement.screenshot_as_base64  s     }}W778AAr    c                J    [        U R                  R                  S5      5      $ )zGets the screenshot of the current element as a binary data.

Returns:
--------
bytes : The screenshot of the element as binary data.

Example:
--------
>>> element_png = element.screenshot_as_png
ascii)r   r   encoder;   s    r   screenshot_as_pngWebElement.screenshot_as_png  s      2299'BCCr    c                :   UR                  5       R                  S5      (       d  [        R                  " S[        5        U R
                  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)a  Saves a screenshot of the current element to a PNG image file.
Returns False if there is any IOError, else returns True. Use full
paths in your filename.

Returns:
--------
bool : True if the screenshot was saved successfully, False otherwise.

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

Element:
--------
>>> element.screenshot('/Screenshots/foo.png')
z.pngz^name used for saved screenshot does not match file type. It should end with a `.png` extensionwbNFT)	lowerendswithwarningswarnUserWarningr   openwriteOSError)r2   filenamepngfs       r   
screenshotWebElement.screenshot  s    & ~~((00MMp $$	h% &
  &% 		 sH   B A5+B 5
B?B B B 
BB BB Bc                    U R                   $ )zInternal reference to the WebDriver instance this element was found
from.

Example:
--------
>>> element = driver.find_element(By.ID, 'foo')
>>> parent_element = element.parent
)r0   r;   s    r   r3   WebElement.parent	  s     ||r    c                    U R                   $ )zInternal ID used by selenium.

This is mainly for internal use. Simple use cases such as checking if 2
webelements refer to the same element, can be done using ``==``::

Example:
--------
>>> if element1 == element2:
...     print("These 2 are equal")
)r1   r;   s    r   idWebElement.id  s     xxr    c                Z    [        US5      =(       a    U R                  UR                  :H  $ )Nr   )hasattrr1   r   r2   elements     r   __eq__WebElement.__eq__#  s!    w%@$((gjj*@@r    c                .    U R                  U5      (       + $ r/   )r   r   s     r   __ne__WebElement.__ne__&  s    ;;w'''r    Nc                h    U(       d  0 nU R                   US'   U R                  R                  X5      $ )a2  Executes a command against the underlying HTML element.

Parameters:
----------
command : any
    The name of the command to _execute as a string.

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

Returns:
-------
  The command's JSON response loaded into a dictionary object.
r   )r1   r0   execute)r2   commandparamss      r   r@   WebElement._execute*  s.     Fxxt||##G44r    c                    U R                   R                  R                  X5      u  p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.
usingr?   r?   )r0   locator_converterconvertr@   r   FIND_CHILD_ELEMENTr2   byr?   s      r   find_elementWebElement.find_element>  s@    4 LL22::2E	}}W7729VWX_``r    c                    U R                   R                  R                  X5      u  pU R                  [        R
                  XS.5      S   $ )a^  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   r?   )r0   r   r   r@   r   FIND_CHILD_ELEMENTSr   s      r   find_elementsWebElement.find_elements[  s@    4 LL22::2E	}}W88B:WXY`aar    c                z    [        [        U R                  R                  S5      5      R	                  5       S5      $ )Nutf-8   )intmd5_hashr1   r   	hexdigestr;   s    r   __hash__WebElement.__hash__x  s*    8DHHOOG45??A2FFr    c                Z   [        5       n[        R                  " US[        R                  5      nUR	                  U[
        R                  R                  U5      S   5        UR                  5         [        UR                  5       5      n[        U[        5      (       d  UR                  S5      n U R                  [        R                   SU05      S   $ ! ["         aH  nS[        U5      ;   a  Us S nA$ S[        U5      ;   a  Us S nA$ S[        U5      ;   a  Us S nA$ e S nAff = f)	Nwr   r   r   r?   zUnrecognized command: POSTzCommand not found: POST z.{"status":405,"value":["GET","HEAD","DELETE"]})r   zipfileZipFileZIP_DEFLATEDr   ospathr   closer   getvalue
isinstancerr   r   r@   r   UPLOAD_FILEr   )r2   r   fpzippedcontentes         r   r|   WebElement._upload{  s    YS'*>*>?Xrww}}X6q9:bkkm,'3''nnW-G		==!4!4vw6GHQQ! 	+s1v5)SV3?3q6I	s<   3$C 
D*"D%2D*8D%D*D%D*$D%%D*)r1   r0   )returnNone)r  rr   )r  zstr | bool | WebElement | dict)r  z
str | None)r  bool)r?   rr   r  r  )r  r   )r  dict)r  bytesr/   )r  r,   )r  zList[WebElement])r  r   )+r   r%   r&   r'   r(   r5   r<   propertyrB   rF   rJ   rQ   rU   r[   r_   rd   rh   rl   r   r   r   r   r   r   r   r   r   r   r   r   r   r3   r   r   r   r@   r   IDr   r   r   r|   r)   r$   r    r   r,   r,   >   s   
~ D D @ @-o2-_,U($LCB.
` ? ?,
w D D.  r$   @ @ E E F F B B D D D 	 	  A(5( !ee4 a:  "uuD b:Gr    r,   )"
__future__r   r   r   r   r   abcr   base64r   r   hashlibr   r   ior   typingr	   selenium.common.exceptionsr
   r   selenium.webdriver.common.byr   selenium.webdriver.common.utilsr   r   r   
shadowrootr   r   r   r   r"   r,   r$   r    r   <module>r     sf   " # 	       #   : 9 + :  " M	w 	N	 N	r    