a
    7ñ»j© ã                   @   sb  d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ d—dd„Zd˜dd„Zd™dd„Zdšdd„Zd›dd„Z dœd d!„Z!d�d"d#„Z"džd$d%„Z#dŸd&d'„Z$d(d)„ Z%d*d+„ Z&ddej'd,fd-d.„Z(dej'fd/d0„Z)dej'fd1d2„Z*dej+dd,fd3d4„Z,dej+dd,fd5d6„Z-dej+fd7d8„Z.dej+fd9d:„Z/ej+g d,fd;d<„Z0ej+g d,fd=d>„Z1ddej+fd?d@„Z2dej+dfdAdB„Z3dej+dfdCdD„Z4dej+dfdEdF„Z5ddej+fdGdH„Z6ddej+fdIdJ„Z7dej+fdKdL„Z8ddej+fdMdN„Z9d dOdP„Z:d¡dQdR„Z;d¢dSdT„Z<ej+fdUdV„Z=ej+fdWdX„Z>ej+fdYdZ„Z?ej'd,fd[d\„Z@d£d^d_„ZAej'd]fd`da„ZBdbdc„ ZCddde„ ZDdfdg„ ZEdej'fdhdi„ZFej'fdjdk„ZGd¤dldm„ZHdndo„ ZIdej'fdpdq„ZJdej+fdrds„ZKdej+fdtdu„ZLdej+fdvdw„ZMd¥dxdy„ZNd¦dzd{„ZOdej'fd|d}„ZPdej'fd~d„ZQdej'fd€d�„ZRddej'fd‚dƒ„ZSddej'fd„d…„ZTdej'fd†d‡„ZUddej'fdˆd‰„ZVdej+fdŠd‹„ZWdej+fdŒd�„ZXdej+fdŽd�„ZYdej+fd�d‘„ZZdej+fd’d“„Z[d”dej+fd•d–„Z\dS )§a  This module contains useful methods for waiting on elements to load.

These methods improve and expand on existing WebDriver commands.
Improvements include making WebDriver commands more robust and more reliable
by giving page elements enough time to load before taking action on them.

The default option for searching for elements is by "css selector".
This can be changed by overriding the "By" parameter from this import:
> from selenium.webdriver.common.by import By
Options are:
By.CSS_SELECTOR        # "css selector"
By.CLASS_NAME          # "class name"
By.ID                  # "id"
By.NAME                # "name"
By.LINK_TEXT           # "link text"
By.XPATH               # "xpath"
By.TAG_NAME            # "tag name"
By.PARTIAL_LINK_TEXT   # "partial link text"
é    N)Úsuppress)ÚFileLock)ÚElementNotInteractableException)ÚElementNotVisibleException)ÚNoAlertPresentException)ÚNoSuchAttributeException)ÚNoSuchElementException)ÚNoSuchWindowException)ÚStaleElementReferenceException)ÚActionChains)ÚKeys)ÚLinkTextNotFoundException)ÚTextNotVisibleException)Úsettings)Ú	constants)Ú
page_utils)Úshared_utilsúcss selectorc                 C   sR   t | ƒr| j |¡S t ||¡\}}z| j||d� W dS  tyL   Y dS 0 dS )aA  
    Returns whether the specified element selector is present on the page.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    @Returns
    Boolean (is element present)
    ©ÚbyÚvalueTFN)Ú__is_cdp_swap_neededÚcdpÚis_element_presentr   Ú swap_selector_and_by_if_reversedÚfind_elementÚ	Exception)ÚdriverÚselectorr   © r   úHE:\soccer\ml_env\Lib\site-packages\seleniumbase/fixtures/page_actions.pyr   )   s    
r   c                 C   sV   t | ƒr| j |¡S t ||¡\}}z| j||d�}| ¡ W S  tyP   Y dS 0 dS )aA  
    Returns whether the specified element selector is visible on the page.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    @Returns
    Boolean (is element visible)
    r   FN)r   r   Úis_element_visibler   r   r   Úis_displayedr   ©r   r   r   Úelementr   r   r    r!   =   s    

r!   c                 C   sL   t | ƒ z*| j||d�}| ¡ r.| ¡ r.W dS W dS  tyF   Y dS 0 dS )a9  
    Returns whether the specified element selector is clickable.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    @Returns
    Boolean (is element clickable)
    r   TFN)Ú_reconnect_if_disconnectedr   r"   Ú
is_enabledr   r#   r   r   r    Úis_element_clickableQ   s    
r'   c                 C   s:   t | ƒ z| j||d�}| ¡ W S  ty4   Y dS 0 dS )aA  
    Returns whether the specified element selector is enabled on the page.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    @Returns
    Boolean (is element enabled)
    r   FN)r%   r   r&   r   r#   r   r   r    Úis_element_enablede   s    

r(   Úhtmlc                 C   s¨   t | ƒ t ||¡\}}t|ƒ}zn| j||d�}|j}t | ¡rf|j 	¡ dv rZ| 
d¡}q~| 
d¡}n|j 	¡ dv r~| d¡}| ¡ oŒ||v W S  ty¢   Y dS 0 dS )ae  
    Returns whether the text substring is visible in the given selector.
    @Params
    driver - the webdriver object (required)
    text - the text string to search for (required)
    selector - the locator for identifying the page element
    by - the type of selector being used (Default: "css selector")
    @Returns
    Boolean (is text visible)
    r   ©ÚinputZtextarear   Ú	innerTextFN)r%   r   r   Ústrr   Útextr   Ú	is_safariÚtag_nameÚlowerÚget_attributeÚget_propertyr"   r   ©r   r.   r   r   r$   Úelement_textr   r   r    Úis_text_visiblew   s    

r6   c                 C   s°   t | ƒ t ||¡\}}t|ƒ}zv| j||d�}|j}t | ¡rf|j 	¡ dv rZ| 
d¡}q~| 
d¡}n|j 	¡ dv r~| d¡}| ¡ o”| ¡ | ¡ kW S  tyª   Y dS 0 dS )aš  
    Returns whether the exact text is visible in the given selector.
    (Ignores leading and trailing whitespace)
    @Params
    driver - the webdriver object (required)
    text - the text string to search for (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    @Returns
    Boolean (is text visible)
    r   r*   r   r,   FN)r%   r   r   r-   r   r.   r   r/   r0   r1   r2   r3   r"   Ústripr   r4   r   r   r    Úis_exact_text_visible”   s"    

þr8   c                 C   sŠ   t | ƒr| jj|||d�S t| ƒ zN| j||d�}| |¡}|du rJW dS |durh||kr`W dS W dS nW dS W n ty„   Y dS 0 dS )aÑ  
    Returns whether the specified attribute is present in the given selector.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    attribute - the attribute that is expected for the element (required)
    value - the attribute value that is expected (Default: None)
    by - the type of selector being used (Default: "css selector")
    @Returns
    Boolean (is attribute present)
    )r   r   NFT)r   r   Úis_attribute_presentr%   r   r2   r   )r   r   Ú	attributer   r   r$   Úfound_valuer   r   r    r9   µ   s"    ÿ

r9   c                 C   sœ   t | ƒ zz| j||d�}|j}t | ¡rN|j ¡ dv rB| d¡}qf| d¡}n|j ¡ dv rf| d¡}| 	¡ }| 
¡ o€t|ƒdkW S  ty–   Y dS 0 dS )ae  
    Returns whether the element has any text visible for the given selector.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    @Returns
    Boolean (is any text visible in the element with the selector)
    r   r*   r   r,   r   FN)r%   r   r.   r   r/   r0   r1   r2   r3   r7   r"   Úlenr   )r   r   r   r$   r5   r   r   r    Úis_non_empty_text_visibleØ   s    


r=   c                 C   s0   t | ƒ | j||d�}t| ƒ |¡}| ¡  |S )a  
    Fires the hover event for the specified element by the given selector.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    r   )r%   r   r   Úmove_to_elementÚperform)r   r   r   r$   Úhoverr   r   r    Úhover_on_elementó   s
    rA   c                 C   s"   t | ƒ t| ƒ |¡}| ¡  |S )zP
    Similar to hover_on_element(), but uses found element, not a selector.
    )r%   r   r>   r?   )r   r$   r@   r   r   r    Úhover_element  s    rB   c                 C   s   t  | |¡\}}||ƒ‚d S )N)r   Ú
format_exc)Ú	exceptionÚmessageÚexcÚmsgr   r   r    Útimeout_exception  s    rH   Fc              	   C   sð   t | ƒ t ¡ d }||d  }| j||d�}	t| ƒ |	¡}
tt|d ƒƒD ]v}z:|
 ¡  | j||d�}	|rz|  d|	¡ n|	 	¡  |	W   S  t
yÀ   t ¡ d }||kr²Y  qÄt d¡ Y qL0 qLd}|dkrÔd}d	|||f }tt|ƒ d
S )a’  
    Fires the hover event for a specified element by a given selector, then
    clicks on another element specified. Useful for dropdown hover based menus.
    @Params
    driver - the webdriver object (required)
    hover_selector - the css selector to hover over (required)
    click_selector - the css selector to click on (required)
    hover_by - the hover selector type to search by (Default: "css selector")
    click_by - the click selector type to search by (Default: "css selector")
    timeout - number of seconds to wait for click element to appear after hover
    js_click - the option to use js_click() instead of click() on the last part
    ç     @�@r   é
   zarguments[0].click();çš™™™™™¹?Úsé   Ú ú/Element {%s} was not present after %s second%s!N)r%   Útimer   r   r>   ÚrangeÚintr?   Úexecute_scriptÚclickr   ÚsleeprH   r   )r   Zhover_selectorÚclick_selectorZhover_byÚclick_byÚtimeoutÚjs_clickÚstart_msÚstop_msr$   r@   ÚxÚnow_msÚpluralrE   r   r   r    Úhover_and_click  s6    
ýr_   c              	   C   sÐ   t | ƒ t ¡ d }||d  }t| ƒ |¡}tt|d ƒƒD ]d}z(| ¡  | j||d�}| ¡  |W   S  t	y    t ¡ d }	|	|kr’Y  q¤t 
d¡ Y q>0 q>d}
|dkr´d}
d|||
f }tt|ƒ d	S )
zQ
    Similar to hover_and_click(), but assumes top element is already found.
    rI   rJ   r   rK   rL   rM   rN   rO   N)r%   rP   r   r>   rQ   rR   r?   r   rT   r   rU   rH   r   )r   r$   rV   rW   rX   rZ   r[   r@   r\   r]   r^   rE   r   r   r    Úhover_element_and_clickD  s0    

ýr`   c              	   C   sì   t | ƒ t ¡ d }||d  }t| ƒ |¡}tt|d ƒƒD ]€}zD| ¡  | j||d�}	t| ƒ}
|
 |	¡ |
 |	¡ |
 ¡  |	W   S  t	y¼   t ¡ d }||kr®Y  qÀt 
d¡ Y q>0 q>d}|dkrÐd}d|||f }tt|ƒ d S )	NrI   rJ   r   rK   rL   rM   rN   rO   )r%   rP   r   r>   rQ   rR   r?   r   Zdouble_clickr   rU   rH   r   )r   r$   rV   rW   rX   rZ   r[   r@   r\   Z	element_2Zactionsr]   r^   rE   r   r   r    Úhover_element_and_double_clickh  s6    


ýra   c              	   C   sä   t | ƒ d}t ¡ d }||d  }tt|d ƒƒD ]`}	|sDt ¡  z| j||d�}|W   S  ty’   t ¡ d }
|
|kr„Y  q–t d¡ Y q40 q4d}|dkr¦d}|sÜ|rÂd	|v rÂd
|v rÂ|}d|||f }t	t
|ƒ n|S dS )a´  
    Searches for the specified element by the given selector. Returns the
    element object if it exists in the HTML. (The element can be invisible.)
    Raises NoSuchElementException if the element does not exist in the HTML
    within the specified timeout.
    @Params
    driver - the webdriver object
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for elements in seconds
    original_selector - handle pre-converted ":contains(TEXT)" selector
    ignore_test_time_limit - ignore test time limit (NOT related to timeout)
    @Returns
    A web element object
    NrI   rJ   r   rK   rL   rM   rN   ú
:contains(ú
contains(.rO   )r%   rP   rQ   rR   r   Úcheck_if_time_limit_exceededr   r   rU   rH   r   )r   r   r   rX   Úoriginal_selectorÚignore_test_time_limitr$   rZ   r[   r\   r]   r^   rE   r   r   r    Úwait_for_element_presentŒ  sB    
ÿþýýrg   c              	   C   sV  t | ƒ d}d}t ¡ d }||d  }	tt|d ƒƒD ]z}
|sHt ¡  z2| j||d�}d}| ¡ rn|W   S d}tƒ ‚W q8 ty°   t ¡ d }||	kr¢Y  q´t 	d¡ Y q80 q8d}|d	krÄd
}|�s$|dk�r$|rìd|v rìd|v rì|}|�s
d|||f }t
t|ƒ d|||f }t
t|ƒ n.|�sN|dk�rNd|||f }t
t|ƒ n|S dS )aK  
    Searches for the specified element by the given selector. Returns the
    element object if the element is present and visible on the page.
    Raises NoSuchElementException if the element does not exist in the HTML
    within the specified timeout.
    Raises ElementNotVisibleException if the element exists in the HTML,
    but is not visible (eg. opacity is "0") within the specified timeout.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for elements in seconds
    original_selector - handle pre-converted ":contains(TEXT)" selector
    ignore_test_time_limit - ignore test time limit (NOT related to timeout)
    @Returns
    A web element object
    NFrI   rJ   r   TrK   rL   rM   rN   ú	link textrb   rc   rO   ú/Element {%s} was not visible after %s second%s!ú/Link text {%s} was not found after %s second%s!)r%   rP   rQ   rR   r   rd   r   r"   r   rU   rH   r   r   r   )r   r   r   rX   re   rf   r$   Ú
is_presentrZ   r[   r\   r]   r^   rE   r   r   r    Úwait_for_element_visibleÆ  sh    

ÿþýý
ýýrl   c              	   C   sR  t | ƒ d}d}d}t|ƒ}t ¡ d }||d  }	tt|d ƒƒD �]l}
t ¡  d}�z| j||d�}d}|j 	¡ dv rÆt 
| ¡sÆ| ¡ r¤|| d¡v r¤|W   S | ¡ rº| d¡ ¡ }d}tƒ ‚n¬t 
| ¡�r4d	}|j 	¡ dv rèd}| ¡ �r|| |¡v �r|W   S | ¡ �r(| |¡}| ¡ }d}tƒ ‚n>| ¡ �rT||jv �rT|W   S | ¡ �rh|j ¡ }d}tƒ ‚W qD t�y°   t ¡ d }||	k�r¢Y  �q´t d
¡ Y qD0 qDd}|dk�rÆd}|�sJ|�sêd|||f }tt|ƒ d}|�rtt| dd¡ƒƒdk�r d||||f }n| dd¡}d|||||f }tt|ƒ n|S dS )aj  
    Searches for the specified element by the given selector. Returns the
    element object if the text is present in the element and visible
    on the page.
    Raises NoSuchElementException if the element does not exist in the HTML
    within the specified timeout.
    Raises ElementNotVisibleException if the element exists in the HTML,
    but the text is not visible within the specified timeout.
    @Params
    driver - the webdriver object (required)
    text - the text that is being searched for in the element (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for elements in seconds
    browser - used to handle a special edge case when using Safari
    @Returns
    A web element object that contains the text searched for
    NFrI   rJ   r   Tr*   r   r,   rK   rL   rM   rN   rO   Ú
i@  zHExpected text substring {%s} for {%s} was not visible after %s second%s!z\n zhExpected text substring {%s} for {%s} was not visible after %s second%s!
 (Actual string found was {%s}))r%   r-   rP   rQ   rR   r   rd   r   r0   r1   r/   r"   r3   r7   r   r2   r.   rU   rH   r   r<   Úreplacer   )r   r.   r   r   rX   r$   rk   Ú	full_textrZ   r[   r\   Ú	text_attrr]   r^   rE   r   r   r    Úwait_for_text_visible  s–    ÿþÿþ
ÿþ








ý
 
ÿÿþÿrq   c              	   C   sX  t | ƒ d}d}d}t|ƒ}t ¡ d }||d  }	tt|d ƒƒD �]z}
t ¡  d}�z*| j||d�}d}|j 	¡ dv rÄ| 
¡ r¢| ¡ | d¡ ¡ kr¢|W   S | 
¡ r¸| d¡ ¡ }d}tƒ ‚n¼t | ¡�r:d	}|j 	¡ dv ræd}| 
¡ �r| ¡ | |¡ ¡ k�r|W   S | 
¡ �r.| |¡}| ¡ }d}tƒ ‚nF| 
¡ �rb| ¡ |j ¡ k�rb|W   S | 
¡ �rv|j ¡ }d}tƒ ‚W qD t�y¾   t ¡ d }||	k�r°Y  �qÂt d
¡ Y qD0 qDd}|dk�rÔd}|�sP|�sød|||f }tt|ƒ d}|�rtt|ƒƒdk�r&d||||f }n| dd¡}d|||||f }tt|ƒ n|S dS )a�  
    Searches for the specified element by the given selector. Returns the
    element object if the text matches exactly with the text in the element,
    and the text is visible.
    Raises NoSuchElementException if the element does not exist in the HTML
    within the specified timeout.
    Raises ElementNotVisibleException if the element exists in the HTML,
    but the exact text is not visible within the specified timeout.
    @Params
    driver - the webdriver object (required)
    text - the exact text that is expected for the element (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for elements in seconds
    browser - used to handle a special edge case when using Safari
    @Returns
    A web element object that contains the text searched for
    NFrI   rJ   r   Tr*   r   r,   rK   rL   rM   rN   rO   éx   zDExpected exact text {%s} for {%s} was not visible after %s second%s!rm   z\nz\Expected exact text {%s} for {%s} was not visible after %s second%s!
 (Actual text was {%s}))r%   r-   rP   rQ   rR   r   rd   r   r0   r1   r"   r7   r3   r   r/   r2   r.   rU   rH   r   r<   rn   r   )r   r.   r   r   rX   r$   rk   Zactual_textrZ   r[   r\   rp   r]   r^   rE   r   r   r    Úwait_for_exact_text_visible‡  s”    ÿþ

ÿ


ÿþ





ý

ÿÿþÿrs   c              
   C   s‚  t |ttfƒstdƒ‚|s"tdƒ‚t| ƒ d}d}t ¡ d }||d  }tt|d ƒƒD ]¼}	|sjt 	¡  zn|D ]\}
d}t
 |
¡r†d}z2| j||
d	�}d
}| ¡ r²|W   W   S d}W qp tyÊ   Y qp0 qptdƒ‚W qZ t�y   t ¡ d }||k�rY  �qt d¡ Y qZ0 qZd}|dk�r*d}|�r4|}|�sz|�s\dt|ƒ||f }tt|ƒ dt|ƒ||f }tt|ƒ n|S dS )aþ  
    Waits for at least one of the elements in the selector list to be visible.
    Returns the first element that is found.
    Raises NoSuchElementException if none of the elements exist in the HTML
    within the specified timeout.
    Raises ElementNotVisibleException if the element exists in the HTML,
    but is not visible (eg. opacity is "0") within the specified timeout.
    @Params
    driver - the webdriver object (required)
    selectors - the list of selectors for identifying page elements (required)
    timeout - the time to wait for elements in seconds
    original_selectors - handle pre-converted ":contains(TEXT)" selectors
    ignore_test_time_limit - ignore test time limit (NOT related to timeout)
    @Returns
    A web element object
    ú$`selectors` must be a list or tuple!ú$`selectors` cannot be an empty list!NFrI   rJ   r   Úxpathr   TúNothing found yet!rK   rL   rM   rN   z9None of the elements {%s} were present after %s second%s!z7None of the elements %s were visible after %s second%s!)Ú
isinstanceÚlistÚtupler   r%   rP   rQ   rR   r   rd   r   Úis_xpath_selectorr   r"   rU   r-   rH   r   r   )r   Ú	selectorsrX   Úoriginal_selectorsrf   r$   Zany_presentrZ   r[   r\   r   r   r]   r^   rE   r   r   r    Ú wait_for_any_of_elements_visibleõ  sh    


ýÿ
ýr~   c              
   C   sB  t |ttfƒstdƒ‚|s"tdƒ‚t| ƒ d}t ¡ d }||d  }tt|d ƒƒD ]¢}|sft 	¡  zZ|D ]H}	d}
t
 |	¡r‚d}
z| j|
|	d�}|W   W   S  ty²   Y ql0 qltd	ƒ‚W qV työ   t ¡ d }||krèY  qút d
¡ Y qV0 qVd}|dk�rd}|�r|}|�s:dt|ƒ||f }tt|ƒ n|S dS )a¨  
    Waits for at least one of the elements in the selector list to be present.
    Visibility not required. (Eg. <head> hidden in the HTML)
    Returns the first element that is found.
    Raises NoSuchElementException if none of the elements exist in the HTML
    within the specified timeout.
    @Params
    driver - the webdriver object (required)
    selectors - the list of selectors for identifying page elements (required)
    timeout - the time to wait for elements in seconds
    original_selectors - handle pre-converted ":contains(TEXT)" selectors
    ignore_test_time_limit - ignore test time limit (NOT related to timeout)
    @Returns
    A web element object
    rt   ru   NrI   rJ   r   rv   r   rw   rK   rL   rM   rN   z7None of the elements %s were present after %s second%s!)rx   ry   rz   r   r%   rP   rQ   rR   r   rd   r   r{   r   rU   r-   rH   r   )r   r|   rX   r}   rf   r$   rZ   r[   r\   r   r   r]   r^   rE   r   r   r    Ú wait_for_any_of_elements_presentF  sR    

ýÿr   c              	   C   sp  t | ƒ d}d}d}d}	t ¡ d }
|
|d  }tt|d ƒƒD ]°}t ¡  zl| j||d�}d}d}| |¡}	|	dur|d}n
d}tƒ ‚|dur¬|	|kr |W   S d}tƒ ‚n
|W   S W q@ tyî   t ¡ d }||kràY  qòt 	d¡ Y q@0 q@d}|d	k�rd
}|�sh|�s(d|||f }t
t|ƒ |�sHd||||f }t
t|ƒ d||||||	f }t
t|ƒ n|S dS )a±  
    Searches for the specified element attribute by the given selector.
    Returns the element object if the expected attribute is present
    and the expected attribute value is present (if specified).
    Raises NoSuchElementException if the element does not exist in the HTML
    within the specified timeout.
    Raises NoSuchAttributeException if the element exists in the HTML,
    but the expected attribute/value is not present within the timeout.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    attribute - the attribute that is expected for the element (required)
    value - the attribute value that is expected (Default: None)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for the element attribute in seconds
    @Returns
    A web element object that contains the expected attribute/value
    NFrI   rJ   r   TrK   rL   rM   rN   rO   zJExpected attribute {%s} of element {%s} was not present after %s second%s!zuExpected value {%s} for attribute {%s} of element {%s} was not present after %s second%s! (The actual value was {%s}))r%   rP   rQ   rR   r   rd   r   r2   r   rU   rH   r   r   )r   r   r:   r   r   rX   r$   Zelement_presentZattribute_presentr;   rZ   r[   r\   r]   r^   rE   r   r   r    Úwait_for_attributeŠ  sh    


ý

ÿÿ
þÿr€   c              	   C   sÈ  t | ƒ d}d}d}t ¡ d }||d  }	tt|d ƒƒD ]Ž}
t ¡  zJ| j||d�}d}| ¡ r†d}| ¡ rz|W   S d}t	ƒ ‚n
d}t	ƒ ‚W q< t	yÈ   t ¡ d }||	krºY  qÌt 
d¡ Y q<0 q<d}|d	krÜd
}|�s`|dk�r`|�r
d|v �r
d|v �r
|}|�s(d|||f }tt|ƒ |�sFd|||f }tt|ƒ d|||f }tt|ƒ nd|�s�|dk�r�|�s�d|||f }tt|ƒ n4|�sÀ|dk�rÀ|�rÀd|||f }tt|ƒ n|S dS )aT  
    Searches for the specified element by the given selector. Returns the
    element object if the element is present, visible, & clickable on the page.
    Raises NoSuchElementException if the element does not exist in the HTML
    within the specified timeout.
    Raises ElementNotVisibleException if the element exists in the HTML,
    but is not visible (eg. opacity is "0") within the specified timeout.
    Raises ElementNotInteractableException if the element is not clickable.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for elements in seconds
    original_selector - handle pre-converted ":contains(TEXT)" selector
    @Returns
    A web element object
    NFrI   rJ   r   TrK   rL   rM   rN   rh   rb   rc   rO   ri   z1Element {%s} was not clickable after %s second%s!rj   z3Link text {%s} was not clickable after %s second%s!)r%   rP   rQ   rR   r   rd   r   r"   r&   r   rU   rH   r   r   r   r   )r   r   r   rX   re   r$   rk   Z
is_visiblerZ   r[   r\   r]   r^   rE   r   r   r    Úwait_for_element_clickableã  sŒ    

ÿþýý
ý
ýýýr�   c              	   C   s  t | ƒrFt |¡r|}nt |¡r&|}t ||¡\}}| j |¡ dS t| ƒ t ¡ d }||d  }tt	|d ƒƒD ]Z}t
 ¡  z6| j||d� t ¡ d }||kr¬W  qÒt d¡ W qv tyÎ   Y  dS 0 qvd}	|dkrâd}	|rúd	|v rúd
|v rú|}d|||	f }
tt|
ƒ dS )aÓ  
    Searches for the specified element by the given selector.
    Raises an exception if the element is still present after the
    specified timeout.
    @Params
    driver - the webdriver object
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for elements in seconds
    original_selector - handle pre-converted ":contains(TEXT)" selector
    TrI   rJ   r   rK   rL   rM   rN   rb   rc   z1Element {%s} was still present after %s second%s!N)r   r   Úis_valid_byÚrecalculate_selectorr   Úwait_for_element_absentr%   rP   rQ   rR   r   rd   r   rU   r   rH   )r   r   r   rX   re   rZ   r[   r\   r]   r^   rE   r   r   r    r„   H  sJ    

ÿþýýr„   c              	   C   s.  t | ƒrFt |¡r|}nt |¡r&|}t ||¡\}}| j |¡ dS t| ƒ t ¡ d }||d  }tt	|d ƒƒD ]l}t
 ¡  zH| j||d�}| ¡ rÀt ¡ d }	|	|kr´W  qät d¡ nW  dS W qv tyà   Y  dS 0 qvd}
|dkrôd}
|�rd	|v �rd
|v �r|}d|||
f }tt|ƒ dS )aá  
    Searches for the specified element by the given selector.
    Raises an exception if the element is still visible after the
    specified timeout.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for the element in seconds
    original_selector - handle pre-converted ":contains(TEXT)" selector
    TrI   rJ   r   rK   rL   rM   rN   rb   rc   z1Element {%s} was still visible after %s second%s!N)r   r   r‚   rƒ   r   Úwait_for_element_not_visibler%   rP   rQ   rR   r   rd   r   r"   rU   r   rH   )r   r   r   rX   re   rZ   r[   r\   r$   r]   r^   rE   r   r   r    r…   €  sN    

ÿþýýr…   c                 C   s¬   t | ƒ t|ƒ}t ¡ d }||d  }tt|d ƒƒD ]D}t ¡  t| |||d�sZ dS t ¡ d }||krr q~t d¡ q8d}	|dkrŽd}	d	||||	f }
t	t
|
ƒ d
S )ar  
    Searches for the text in the element of the given selector on the page.
    Returns True if the text is not visible on the page within the timeout.
    Raises an exception if the text is still present after the timeout.
    @Params
    driver - the webdriver object (required)
    text - the text that is being searched for in the element (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for elements in seconds
    @Returns
    A web element object that contains the text searched for
    rI   rJ   ©r   TrK   rL   rM   rN   z6Text {%s} in {%s} was still visible after %s second%s!N)r%   r-   rP   rQ   rR   r   rd   r6   rU   rH   r   ©r   r.   r   r   rX   rZ   r[   r\   r]   r^   rE   r   r   r    Úwait_for_text_not_visible»  s,    ürˆ   c                 C   s¬   t | ƒ t|ƒ}t ¡ d }||d  }tt|d ƒƒD ]D}t ¡  t| |||d�sZ dS t ¡ d }||krr q~t d¡ q8d}	|dkrŽd}	d	||||	f }
t	t
|
ƒ d
S )az  
    Searches for the text in the element of the given selector on the page.
    Returns True if the element is missing the exact text within the timeout.
    Raises an exception if the exact text is still present after the timeout.
    @Params
    driver - the webdriver object (required)
    text - the text that is being searched for in the element (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for elements in seconds
    @Returns
    A web element object that contains the text searched for
    rI   rJ   r†   TrK   rL   rM   rN   z=Exact text {%s} for {%s} was still visible after %s second%s!N)r%   r-   rP   rQ   rR   r   rd   r8   rU   rH   r   r‡   r   r   r    Úwait_for_exact_text_not_visibleç  s.    üÿr‰   c              	   C   sŒ  t | ƒ t ¡ d }||d  }d}d}tt|d ƒƒD ]ä}t ¡  zšd}d}| j||d�}| ¡ rhd}|j}	t 	| ¡rž|j
 ¡ dv r’| d¡}	q¶| d	¡}	n|j
 ¡ dv r¶| d¡}	|	 ¡ }	| ¡ rÜt|	ƒd
krÜ|W   S W n tyô   d}Y n0 t ¡ d }
|
|k�r �qt d¡ q8d}|dk�r0d}|�sPd|||f }tt|ƒ n8|�spd|||f }tt|ƒ nd|||f }tt|ƒ dS )a{  
    Searches for any text in the element of the given selector.
    Returns the element if it has visible text within the timeout.
    Raises an exception if the element has no text within the timeout.
    Whitespace-only text is considered empty text.
    @Params
    driver - the webdriver object (required)
    text - the text that is being searched for in the element (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for elements in seconds
    @Returns
    The web element object that has text
    rI   NrJ   Fr   Tr*   r   r,   r   rK   rL   rM   rN   rO   ri   z3Element {%s} has no visible text after %s second%s!)r%   rP   rQ   rR   r   rd   r   r"   r.   r/   r0   r1   r2   r3   r7   r<   r   rU   rH   r   r   r   )r   r   r   rX   rZ   r[   r$   Úvisibler\   r5   r]   r^   rE   r   r   r    Úwait_for_non_empty_text_visible  sf    




ýýÿÿr‹   c                 C   s´   t   ¡ d }||d  }tt|d ƒƒD ]F}t ¡  t| ||||d�sL dS t   ¡ d }	|	|krd qpt  d¡ q(d}
|dkr€d}
d	||||
f }|r¦d
|||||
f }tt|ƒ dS )aš  
    Searches for the specified element attribute by the given selector.
    Returns True if the attribute isn't present on the page within the timeout.
    Also returns True if the element is not present within the timeout.
    Raises an exception if the attribute is still present after the timeout.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    attribute - the element attribute (required)
    value - the attribute value (Default: None)
    by - the type of selector being used (Default: "css selector")
    timeout - the time to wait for the element attribute in seconds
    rI   rJ   ©r   r   TrK   rL   rM   rN   zCAttribute {%s} of element {%s} was still present after %s second%s!zRValue {%s} for attribute {%s} of element {%s} was still present after %s second%s!N)	rP   rQ   rR   r   rd   r9   rU   rH   r   )r   r   r:   r   r   rX   rZ   r[   r\   r]   r^   rE   r   r   r    Úwait_for_attribute_not_present`  s2    
ÿ
ÿÿþÿr�   c              	   C   s$  t | ƒ | j||d�}|r:|dkr:t|ƒ|kr:|d|… }zdd„ |D ƒ}|W S  ttf�y   t d¡ | j||d�}g }|r®|dkr®t|ƒ|kr®|d|… }||d… }g }|D ]}| ¡ r¶| |¡ q¶|�r|�rt|ƒ|k �r|D ](}| ¡ rì| |¡ t|ƒ|krì �qqì| Y S 0 dS )a´  
    Finds all WebElements that match a selector and are visible.
    Similar to webdriver.find_elements().
    If "limit" is set and > 0, will only return that many elements.
    @Params
    driver - the webdriver object (required)
    selector - the locator for identifying the page element (required)
    by - the type of selector being used (Default: "css selector")
    limit - the maximum number of elements to return if > 0.
    r   r   Nc                 S   s   g | ]}|  ¡ r|‘qS r   )r"   )Ú.0r$   r   r   r    Ú
<listcomp>¡  ó    z)find_visible_elements.<locals>.<listcomp>rK   )	r%   Zfind_elementsr<   r
   r   rP   rU   r"   Úappend)r   r   r   ÚlimitÚelementsZv_elemsZextra_elementsr$   r   r   r    Úfind_visible_elements‘  s2    

r”   c                 C   sì   t | ƒ | d¡s|d }|r^tj d¡}tj ||¡}tj |¡sNt |¡ tj ||¡}n|}|rØzL| j||d�}|j	}	t
|dƒ�}
|
 |	¡ W d  ƒ n1 s¦0    Y  W qè tyÔ   | rÐ|  |¡ n Y qè0 n| rè|  |¡ n dS )a‚  
    Saves a screenshot of the current page.
    If no folder is specified, uses the folder where pytest was called.
    The screenshot will include the entire page unless a selector is given.
    If a provided selector is not found, then takes a full-page screenshot.
    If the folder provided doesn't exist, it will get created.
    The screenshot will be in PNG format: (*.png)
    z.pngÚ.r   ÚwbN)r%   ÚendswithÚosÚpathÚabspathÚjoinÚexistsÚmakedirsr   Zscreenshot_as_pngÚopenÚwriter   Zget_screenshot_as_file)r   ÚnameÚfolderr   r   Úabs_pathÚ	file_pathZscreenshot_pathr$   Zelement_pngÚfiler   r   r    Úsave_screenshot·  s.    

,r¥   c           
      C   sÄ   ddl m} t| ƒst| ƒ | d¡s.|d }|rrtj d¡}tj ||¡}tj 	|¡sbt 
|¡ tj ||¡}n|}d}t| ƒrŽ| j ¡ }n| j}| | |¡}t|ddd�}	|	 |¡ |	 ¡  dS )	a  
    Saves the page HTML to the current directory (or given subfolder).
    If the folder specified doesn't exist, it will get created.
    @Params
    name - The file name to save the current page's HTML to.
    folder - The folder to save the file to. (Default = current folder)
    r   )Ú
log_helperz.htmlr•   Nzw+zutf-8)ÚmodeÚencoding)Zseleniumbase.corer¦   r   r%   r—   r˜   r™   rš   r›   rœ   r�   r   Zget_page_sourceÚpage_sourceZget_html_source_with_base_hrefrž   rŸ   Úclose)
r   r    r¡   r¦   r¢   r£   Zhtml_file_pathr©   Zrendered_sourceZ	html_filer   r   r    Úsave_page_sourceß  s,    

ÿ
r«   c                 C   s$   t | ƒ t| |ƒ}|j}| ¡  |S )z¹
    Wait for and accept an alert. Returns the text from the alert.
    @Params
    driver - the webdriver object (required)
    timeout - the time to wait for the alert in seconds
    )r%   Úwait_for_and_switch_to_alertr.   Úaccept©r   rX   ÚalertZ
alert_textr   r   r    Úwait_for_and_accept_alert  s
    
r°   c                 C   s$   t | ƒ t| |ƒ}|j}| ¡  |S )zº
    Wait for and dismiss an alert. Returns the text from the alert.
    @Params
    driver - the webdriver object (required)
    timeout - the time to wait for the alert in seconds
    )r%   r¬   r.   Zdismissr®   r   r   r    Úwait_for_and_dismiss_alert  s
    
r±   c           	   	   C   s¤   t | ƒ t ¡ d }||d  }tt|d ƒƒD ]\}t ¡  z| jj}|j}|W   S  t	yŠ   t ¡ d }||kr|Y  qŽt 
d¡ Y q00 q0d| }tt|ƒ dS )a(  
    Wait for a browser alert to appear, and switch to it. This should be usable
    as a drop-in replacement for driver.switch_to.alert when the alert box
    may not exist yet.
    @Params
    driver - the webdriver object (required)
    timeout - the time to wait for the alert in seconds
    rI   rJ   rK   z'Alert was not present after %s seconds!N)r%   rP   rQ   rR   r   rd   Ú	switch_tor¯   r.   r   rU   rH   r   )	r   rX   rZ   r[   r\   r¯   Zdummy_variabler]   rE   r   r   r    r¬     s     	
r¬   c                 C   sX  t | ƒ t ¡ d }||d  }tt|d ƒƒD ]è}t ¡  z| j |¡ W  dS  t�y   t	|t
ƒrêd}t |¡r~d}nd}t| ||d�s¢|rêt| ||d�rêttƒ�0 | j||d�}| j |¡ W d  ƒ Y  dS 1 sà0    Y  t ¡ d }	|	|k�rY  �qt d	¡ Y q00 q0d
}
|dk�r,d}
d}|�r:d}d||||
f }tt|ƒ dS )al  
    Wait for an iframe to appear, and switch to it. This should be
    usable as a drop-in replacement for driver.switch_to.frame().
    @Params
    driver - the webdriver object (required)
    frame - the frame element, name, id, index, or selector
    timeout - the time to wait for the alert in seconds
    invisible - if True, the iframe can be invisible
    rI   rJ   TNrv   r   r†   r   rK   rL   rM   rN   rŠ   Zpresentz(Frame {%s} was not %s after %s second%s!)r%   rP   rQ   rR   r   rd   r²   Úframer   rx   r-   r   r{   r!   r   r   r   rU   rH   )r   r³   rX   Z	invisiblerZ   r[   r\   r   r$   r]   r^   ZpresencerE   r   r   r    Úswitch_to_frame:  sR    

ÿþþ
$

ür´   Tc                 C   s^   t | dd ƒrN|rNttjjƒ}|� | j |¡ W d   ƒ qZ1 sB0    Y  n| j |¡ dS )NÚ_is_using_ucT)Úgetattrr   r   ZMultiBrowserZPYAUTOGUILOCKr²   Úwindow)r   Úwindow_handleÚuc_lockZgui_lockr   r   r    Ú__switch_to_windowp  s    ,rº   c              	   C   s°  t | ƒ |dkrt| jƒd }t ¡ d }||d  }t|tƒ�r
t | ¡rjt| jƒd | }|dk rjd}tt|d ƒƒD ]d}t 	¡  z | j| }t
| ||d� W  dS  tyÜ   t ¡ d }||krÎY  qàt d¡ Y qz0 qzd	}	|dkrðd
}	d|||	f }
tt|
ƒ n¢|}tt|d ƒƒD ]b}t 	¡  zt
| ||d� W  dS  t�y|   t ¡ d }||k�rnY  �q‚t d¡ Y n0 �qd	}	|dk�r”d
}	d|||	f }
tt|
ƒ dS )au  
    Wait for a window to appear, and switch to it. This should be usable
    as a drop-in replacement for driver.switch_to.window().
    @Params
    driver - the webdriver object (required)
    window - the window index or window handle
    timeout - the time to wait for the window in seconds
    uc_lock - if UC Mode and True, switch_to_window() uses thread-locking
    éÿÿÿÿrM   rI   r   rJ   )r¹   TrK   rL   rN   z.Window {%s} was not present after %s second%s!N)r%   r<   Zwindow_handlesrP   rx   rR   r   r/   rQ   rd   rº   Ú
IndexErrorrU   rH   r   r	   )r   r·   rX   r¹   rZ   r[   r\   r¸   r]   r^   rE   r   r   r    Úswitch_to_windowz  sd    

ý

ýr½   c                 C   sR   t | dd ƒrNt| dƒrN|  ¡ sNttƒ� |  ¡  W d   ƒ n1 sD0    Y  d S )Nrµ   Úis_connected)r¶   Úhasattrr¾   r   r   Úconnect©r   r   r   r    r%   Ã  s    
ÿþý
r%   c                 C   s
   t  | ¡S )z?If the driver is disconnected, use a CDP method when available.)r   Zis_cdp_swap_neededrÁ   r   r   r    r   Í  s    r   c                 C   s¨   t | ƒr| j |¡ d S t| dd ƒr>t| dd ƒs>|  |¡ d S t| dd ƒrnt| dd ƒrn|  ¡  | j |¡ d S t|ƒ ¡ }t 	|¡sšt 
d| ¡ršd| }|  |¡ d S )Nrµ   Z_is_using_cdpzhttps://)r   r   rž   r¶   Zuc_activate_cdp_modeZ
disconnectr-   r7   r   Zlooks_like_a_page_urlZis_valid_urlÚget)r   Úurlr   r   r    Úopen_urlÖ  s*    
ÿ
ý

ÿ
þ
rÄ   c                 C   sD   t  ||¡\}}t| ƒr(| j |¡ d S t| |||d�}| ¡  d S ©N©r   rX   )r   rƒ   r   r   rT   r�   )r   r   r   rX   r$   r   r   r    rT   ñ  s    ÿrT   c                 C   s4   t | ƒr| j |¡ d S t| |d|d�}| ¡  d S )Nrh   rÆ   )r   r   Ú
click_linkr�   rT   )r   Z	link_textrX   r$   r   r   r    rÇ   ü  s    ÿrÇ   c                 C   sª   t  ||¡\}}t| ƒr(| j |¡ d S t| ||d�rHt| ||dd� n^|dkr¦ttƒ�  t	| |||d� W d   ƒ n1 s~0    Y  t| ||d�r¦t| ||dd� d S )Nr†   rM   rÆ   r   )
r   rƒ   r   r   Úclick_if_visibler!   rT   r   r   rl   ©r   r   r   rX   r   r   r    rÈ     s    
ÿ$rÈ   c                 C   s$   t | ƒr| j ¡  d S |  d¡ d S )Nzdocument.activeElement.click();)r   r   Úclick_active_elementrS   rÁ   r   r   r    rÊ     s    
rÊ   c                 C   sv   t  ||¡\}}t| ƒr(| j |¡ d S t| |||d�}| ¡ rH| ¡ sbt 	d¡ t| ||dd�}d}|  
||¡ d S )NrÆ   gš™™™™™É?rM   ad  var simulateClick = function (elem) {
               var evt = new MouseEvent('click', {
                   bubbles: true,
                   cancelable: true,
                   view: window
               });
               var canceled = !elem.dispatchEvent(evt);
           };
           var someLink = arguments[0];
           simulateClick(someLink);)r   rƒ   r   r   rT   rg   r"   r&   rP   rU   rS   )r   r   r   rX   r$   Úscriptr   r   r    rY     s    ÿ
ÿrY   c                 C   sn   t  ||¡\}}t| ƒr*| j ||¡ d S t| |||d�}| d¡sP| |¡ n| |d d… ¡ | ¡  d S ©NrÆ   rm   r»   )r   rƒ   r   r   Ú	send_keysrg   r—   Úsubmit©r   r   r.   r   rX   r$   r   r   r    rÍ   ;  s    ÿ
rÍ   c                 C   s†   t  ||¡\}}t| ƒr*| j ||¡ d S t| |||d�}| d¡sZ|D ]}| |¡ qHn(|d d… D ]}| |¡ qf| tj	¡ d S rÌ   )
r   rƒ   r   r   Ú
press_keysrg   r—   rÍ   r   ZRETURN)r   r   r.   r   rX   r$   Úkeyr   r   r    rÐ   L  s    ÿ
rÐ   c                 C   sv   t  ||¡\}}t| ƒr*| j ||¡ d S t| |||d�}| ¡  | d¡sX| |¡ n| |d d… ¡ | 	¡  d S rÌ   )
r   rƒ   r   r   Útyper�   Úclearr—   rÍ   rÎ   rÏ   r   r   r    Úupdate_text_  s    ÿ
rÔ   c                 C   sH   t  ||¡\}}t| ƒr*| j |d¡ d S t| ||tjd�}| ¡  d S )Nz
rÆ   )	r   rƒ   r   r   rÍ   r�   r   ÚSMALL_TIMEOUTrÎ   r#   r   r   r    rÎ   q  s    
ÿrÎ   c                 C   s"   t  ||¡\}}t| ||||d�S )NrŒ   )r   rƒ   r9   )r   r   r:   r   r   r   r   r    Úhas_attribute|  s    
ÿrÖ   c                 C   s`   d }t  |¡r|}nt  |¡r"|}t  ||¡\}}t| ƒrJ| j |¡ dS t| ||||d� d S ©NT©r   rX   re   )r   r‚   rƒ   r   r   Zassert_elementrl   ©r   r   r   rX   re   r   r   r    Úassert_element_visible…  s     

ûrÚ   c                 C   s`   d }t  |¡r|}nt  |¡r"|}t  ||¡\}}t| ƒrJ| j |¡ dS t| ||||d� d S r×   )r   r‚   rƒ   r   r   Úassert_element_presentrg   rÙ   r   r   r    rÛ   š  s     

ûrÛ   c                 C   sH   d }t  |¡r|}nt  |¡r"|}t  ||¡\}}t| ||||d� d S )NrØ   )r   r‚   rƒ   r…   rÙ   r   r   r    Úassert_element_not_visible¯  s    

ûrÜ   c                 C   sD   t  ||¡\}}t| ƒr*| j ||¡ dS t| | ¡ |||d� d S ©NTrÆ   )r   rƒ   r   r   Úassert_textrq   r7   ©r   r.   r   r   rX   r   r   r    rÞ   Á  s    ÿrÞ   c                 C   sD   t  ||¡\}}t| ƒr*| j ||¡ dS t| | ¡ |||d� d S rÝ   )r   rƒ   r   r   Úassert_exact_textrs   r7   rß   r   r   r    rà   Ñ  s    ÿrà   c                 C   s$   t  ||¡\}}t| |||d� d S rÅ   ©r   rƒ   r‹   rÉ   r   r   r    Úassert_non_empty_textá  s    ÿrâ   c                 C   s*   t  ||¡\}}t| | ¡ |||d� d S rÅ   )r   rƒ   rˆ   r7   rß   r   r   r    Úassert_text_not_visibleí  s    ÿrã   c                 C   sX   d }t  |¡r|}nt  |¡r"|}t  ||¡\}}t| ƒrF| j |¡S t| ||||d�S ©NrÙ   )r   r‚   rƒ   r   r   Úselectrl   rÙ   r   r   r    Úwait_for_elementú  s    

ûræ   c                 C   sX   d }t  |¡r|}nt  |¡r"|}t  ||¡\}}t| ƒrF| j |¡S t| ||||d�S rä   )r   r‚   rƒ   r   r   rå   rg   rÙ   r   r   r    Úwait_for_selector  s    

ûrç   c                 C   s6   t  ||¡\}}t| ƒr$| j |¡S t| ||||d�S ©Nrß   )r   rƒ   r   r   r   rq   rß   r   r   r    Úwait_for_text(  s    ûré   c                 C   s"   t  ||¡\}}t| ||||d�S rè   )r   rƒ   rs   rß   r   r   r    Úwait_for_exact_text;  s    ûrê   c                 C   s    t  ||¡\}}t| |||d�S )NrÉ   rá   rÉ   r   r   r    Úwait_for_non_empty_textL  s    ürë   Úbodyc                 C   sv   t | ƒr| j |¡S t| |||d�}|j}t | ¡rZ|j ¡ dv rN| 	d¡}qr| 	d¡}n|j ¡ dv rr| 
d¡}|S )NrÉ   r*   r   r,   )r   r   Úget_textræ   r.   r   r/   r0   r1   r2   r3   )r   r   r   rX   r$   r5   r   r   r    rí   [  s     ü

rí   )r   )r   )r   )r   )r)   r   )r   )Nr   )r   )r   )r   r   )NNr   )N)T)r   r   )r   )Nr   )]Ú__doc__r˜   rP   Ú
contextlibr   Úfilelockr   Zselenium.common.exceptionsr   r   r   r   r   r	   r
   Z'selenium.webdriver.common.action_chainsr   Zselenium.webdriver.common.keysr   Zseleniumbase.common.exceptionsr   r   Zseleniumbase.configr   Zseleniumbase.fixturesr   r   r   r   r!   r'   r(   r6   r8   r9   r=   rA   rB   rH   rÕ   r_   r`   ra   ZLARGE_TIMEOUTrg   rl   rq   rs   r~   r   r€   r�   r„   r…   rˆ   r‰   r‹   r�   r”   r¥   r«   r°   r±   r¬   r´   rº   r½   r%   r   rÄ   rT   rÇ   rÈ   rÊ   rY   rÍ   rÐ   rÔ   rÎ   rÖ   rÚ   rÛ   rÜ   rÞ   rà   râ   rã   ræ   rç   ré   rê   rë   rí   r   r   r   r    Ú<module>   sP  





" ÿ
#


	ù
7û
(û
'ú
=ú
Vû
sû
qû
Tû
Hú
\û
hû
;û
>û
/û
/ÿ
Oú
1
' ÿ
(
#ÿ
6
ü
I
	 ÿ
ÿ
ÿ
ÿ
ÿ

 ÿ

ÿ
ÿ
ÿ
û
û
ü
û
ü
ü
û
û
ü
ü