
    hg#                         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Zd dlmZ d dlmZ d ZdZdZ G d d	e          ZdS )
    )NoReturn)BaseOptions)Service)OptionsN)ChromiumRemoteConnection)	WebDriverc                        e Zd ZdZedddedefdedef fdZ	d Z
d Zdefd	Zdefd
ZdededefdZdedefdZdefdZd ZdedefdZdedefdZdedefdZdefdZdefdZ xZS )ChromiumDriverz`
    Controls the WebDriver instance of ChromiumDriver and allows you to drive the browser.
    Noptionsservicec
           
      F   |rt          j        dt          d           |t          k    rt          j        dt          d           || _        |t
          k    rt          j        dt          d           |	t          k    r0t          |           k    rt          j        dt          d           nd}	|| _        d}
|s| 	                                }|r0|
                                D ]\  }}|                    ||           |j        r|j        }
|st          d	          || _        | j                                         	 t!          j        | t%          | j        j        |||	|

          |           n## t(          $ r |                                   w xY wd| _        dS )a  
        Creates a new WebDriver instance of the ChromiumDriver.
        Starts the service and then creates new WebDriver instance of ChromiumDriver.

        :Args:
         - browser_name - Browser name used when matching capabilities.
         - vendor_prefix - Company prefix to apply to vendor-specific WebDriver extension commands.
         - port - Deprecated: port you would like the service to run, if left as 0, a free port will be found.
         - options - this takes an instance of ChromiumOptions
         - service_args - Deprecated: List of args to pass to the driver service
         - desired_capabilities - Deprecated: Dictionary object with non-browser specific
           capabilities only, such as "proxy" or "loggingPref".
         - service_log_path - Deprecated: Where to log information from the driver.
         - keep_alive - Deprecated: Whether to configure ChromiumRemoteConnection to use HTTP keep-alive.
        zIdesired_capabilities has been deprecated, please pass in a Service object   )
stacklevelz9port has been deprecated, please pass in a Service objectzEservice_log_path has been deprecated, please pass in a Service objectz?keep_alive has been deprecated, please pass in a Service objectTNzservice cannot be None)remote_server_addrbrowser_namevendor_prefix
keep_aliveignore_proxy)command_executorr   F)warningswarnDeprecationWarningDEFAULT_PORTportDEFAULT_SERVICE_LOG_PATHDEFAULT_KEEP_ALIVEtyper   create_optionsitemsset_capability_ignore_local_proxyAttributeErrorr   startRemoteWebDriver__init__r   service_url	Exceptionquit
_is_remote)selfr   r   r   r   service_argsdesired_capabilitiesservice_log_pathr   r   _ignore_proxykeyvalue	__class__s                ^/var/www/fb-scrape/myenv/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.pyr%   zChromiumDriver.__init__&   s   &   	<Me,< < < <<MU,< < < <	777Ma,< < < <+++T

i0G0GM[,< < < < < J* 	,))++G 	3288:: 3 3
U&&sE2222& 	8#7M 	; !9:::
	$!9'+|'?!-])"G "G "G  ! ! ! ! !  	 	 	IIKKK	  s   3E7 7 Fc                 2    |                      dd|i          S )z&Launches Chromium app specified by id.	launchAppidexecute)r*   r5   s     r2   
launch_appzChromiumDriver.launch_appi   s    ||K$444    c                 8    |                      d          d         S )z
        Gets Chromium network emulation settings.

        :Returns:
            A dict. For example:
            {'latency': 4, 'download_throughput': 2, 'upload_throughput': 2,
            'offline': False}
        getNetworkConditionsr0   r6   r*   s    r2   get_network_conditionsz%ChromiumDriver.get_network_conditionsm   s     ||233G<<r9   returnc                 6    |                      dd|i           dS )a"  
        Sets Chromium network emulation settings.

        :Args:
         - network_conditions: A dict with conditions specification.

        :Usage:
            ::

                driver.set_network_conditions(
                    offline=False,
                    latency=5,  # additional latency (ms)
                    download_throughput=500 * 1024,  # maximal throughput
                    upload_throughput=500 * 1024)  # maximal throughput

            Note: 'throughput' can be used to set both (for download and upload).
        setNetworkConditionsnetwork_conditionsNr6   )r*   rA   s     r2   set_network_conditionsz%ChromiumDriver.set_network_conditionsx   s2    $ 	+ "4.
 	 	 	 	 	r9   c                 0    |                      d           dS )z=
        Resets Chromium network emulation settings.
        deleteNetworkConditionsNr6   r<   s    r2   delete_network_conditionsz(ChromiumDriver.delete_network_conditions   s     	./////r9   namer0   c                 <    |                      dd|i|d           dS )a  
        Sets Applicable Permission.

        :Args:
         - name: The item to set the permission on.
         - value: The value to set on the item

        :Usage:
            ::
                driver.set_permissions('clipboard-read', 'denied')
        setPermissionsrF   )
descriptorstateNr6   )r*   rF   r0   s      r2   set_permissionszChromiumDriver.set_permissions   s+     	%vtnu'U'UVVVVVr9   cmdcmd_argsc                 @    |                      d||d          d         S )a  
        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/

        :Args:
         - cmd: A str, command name
         - cmd_args: A dict, command args. empty dict {} if there is no command args
        :Usage:
            ::
                driver.execute_cdp_cmd('Network.getResponseBody', {'requestId': requestId})
        :Returns:
            A dict, empty dict {} if there is no result to return.
            For example to getResponseBody:
            {'base64Encoded': False, 'body': 'response body string'}
        executeCdpCommand)rL   paramsr0   r6   )r*   rL   rM   s      r2   execute_cdp_cmdzChromiumDriver.execute_cdp_cmd   s'    " ||/1Q1QRRSZ[[r9   c                 8    |                      d          d         S )z?
        :Returns: A list of sinks available for Cast.
        getSinksr0   r6   r<   s    r2   	get_sinkszChromiumDriver.get_sinks   s     ||J''00r9   c                 8    |                      d          d         S )zW
        :Returns: An error message when there is any issue in a Cast session.
        getIssueMessager0   r6   r<   s    r2   get_issue_messagez ChromiumDriver.get_issue_message   s     ||-..w77r9   	sink_namec                 2    |                      dd|i          S )z
        Sets a specific sink, using its name, as a Cast session receiver target.

        :Args:
         - sink_name: Name of the sink to use as the target.
        setSinkToUsesinkNamer6   r*   rX   s     r2   set_sink_to_usezChromiumDriver.set_sink_to_use   s     ||NZ,CDDDr9   c                 2    |                      dd|i          S )z
        Starts a tab mirroring session on a specific receiver target.

        :Args:
         - sink_name: Name of the sink to use as the target.
        startTabMirroringr[   r6   r\   s     r2   start_tab_mirroringz"ChromiumDriver.start_tab_mirroring   s     ||/*i1HIIIr9   c                 2    |                      dd|i          S )z
        Stops the existing Cast session on a specific receiver target.

        :Args:
         - sink_name: Name of the sink to stop the Cast session.
        stopCastingr[   r6   r\   s     r2   stop_castingzChromiumDriver.stop_casting   s     ||MJ	+BCCCr9   c                     	 t          j        |            n# t          $ r Y nw xY w| j                                         dS # | j                                         w xY w)z
        Closes the browser and shuts down the ChromiumDriver executable
        that is started when starting the ChromiumDriver
        N)r$   r(   r'   r   stopr<   s    r2   r(   zChromiumDriver.quit   sq    
	  &&&& 	 	 	D	 LDLs!    A 
$A $A Ac                 P    | j         dk    rt                      S t                      S )Nms)r   EdgeOptionsChromeOptionsr<   s    r2   r   zChromiumDriver.create_options   s$    %%==  ??"r9   )__name__
__module____qualname____doc__r   r   r   r   r   r%   r8   r=   r   rB   rE   strrK   dictrQ   listrT   rW   r]   r`   rc   r(   r   __classcell__)r1   s   @r2   r
   r
   !   s        
 #4d&*=U$(5GA  A -8A  "A  A  A  A  A  A F5 5 5	= 	= 	=h    ,08 0 0 0 0WC W W W W W W\3 \$ \ \ \ \&14 1 1 1 18 8 8E E E E E EJS JS J J J JDc Dc D D D D h        # # # # # # # # #r9   r
   )typingr   !selenium.webdriver.common.optionsr   !selenium.webdriver.common.servicer   selenium.webdriver.edge.optionsr   rh   !selenium.webdriver.chrome.optionsri   r   -selenium.webdriver.chromium.remote_connectionr   #selenium.webdriver.remote.webdriverr   r$   r   r   r   r
    r9   r2   <module>rz      s   $       9 9 9 9 9 9 5 5 5 5 5 5 B B B B B B F F F F F F  R R R R R R L L L L L L  L# L# L# L# L#_ L# L# L# L# L#r9   