a
    Šxdt  ã                   @   sh   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 G d	d
„ d
e	ƒZdS )é    N)ÚDesiredCapabilities)ÚDriverFinder)Ú	WebDriveré   )ÚOptions)ÚDEFAULT_EXECUTABLE_PATH)ÚServicec                       s:   e Zd ZdZeddejdf‡ fdd„	Z‡ fdd„Z‡  Z	S )r   zAControls the WPEWebKitDriver and allows you to drive the browser.r   Nc                    sl   |r|  ¡ }| |¡ |}ntƒ }t|||d| _t | j|¡| j_| j ¡  t	ƒ j
| jj|d d| _dS )aB  Creates a new instance of the WPEWebKit driver.

        Starts the service and then creates new instance of WPEWebKit Driver.

        :Args:
         - executable_path : path to the executable. If the default is used it assumes the executable is in the $PATH.
         - port : port you would like the service to run, if left as 0, a free port will be found.
         - options : an instance of WPEWebKitOptions
         - desired_capabilities : Dictionary object with desired capabilities
         - service_log_path : Path to write service stdout and stderr output.
        )ÚportZlog_path)Zcommand_executorÚdesired_capabilitiesFN)Zto_capabilitiesÚupdater   r   Úservicer   Úget_pathÚpathÚstartÚsuperÚ__init__Zservice_urlZ
_is_remote)ÚselfZexecutable_pathr	   Úoptionsr
   Zservice_log_pathZcapabilities©Ú	__class__© ú^/var/www/html/Ranjet/env/lib/python3.9/site-packages/selenium/webdriver/wpewebkit/webdriver.pyr       s    

zWebDriver.__init__c                    sD   z2zt ƒ  ¡  W n tjy$   Y n0 W | j ¡  n| j ¡  0 dS )z{Closes the browser and shuts down the WPEWebKitDriver executable
        that is started when starting the WPEWebKitDriver.N)r   ÚquitÚhttp_clientÚBadStatusLiner   Ústop)r   r   r   r   r   A   s
    zWebDriver.quit)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Z	WPEWEBKITr   r   Ú__classcell__r   r   r   r   r      s   ú!r   )Úhttp.clientÚclientr   Z.selenium.webdriver.common.desired_capabilitiesr   Z'selenium.webdriver.common.driver_finderr   Z#selenium.webdriver.remote.webdriverr   ZRemoteWebDriverr   r   r   r   r   r   r   r   r   Ú<module>   s   