zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
U
\±dÝã@slddlZddlZddlZddlZddlmZddlmZddlm    Z    ddl
m Z e  e ¡ZGdd„dƒZdS)éN)ÚPath)ÚList)ÚSeleniumManagerException)Ú BaseOptionsc@sXeZdZdZddœdd„Zeedœdd„ƒZee    dœd    d
„Z
ee e    e    d œd d „ƒZ dS)ÚSeleniumManagerzƒWrapper for getting information from the Selenium Manager binaries.
 
    This implementation is still in beta, and may change.
    N)ÚreturncCsdS)N©)Úselfrrúad:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/common/selenium_manager.pyÚ__init__$szSeleniumManager.__init__cCsntj}ddddœ}| |¡r&| |¡n|}|dkr6dnd}ttƒj ||¡}| ¡sjd}t|›d|›ƒ‚|S)z€Determines the path of the correct Selenium Manager binary.
 
        :Returns: The Selenium Manager executable location
        ZmacosZwindows)ÚdarwinÚwin32Úcygwinzselenium-manager.exezselenium-managerz-https://github.com/SeleniumHQ/selenium/issuesz& is missing.  Please open an issue on )    ÚsysÚplatformÚgetrÚ__file__ÚparentÚjoinpathÚis_filer)rÚdirsÚ    directoryÚfileÚpathÚtrackerrrr
Ú
get_binary'sýzSeleniumManager.get_binary)ÚoptionsrcCsºt d¡|jd}t| ¡ƒd|ddg}|jrJ| d¡| t|jƒ¡t|ddƒ}|rr| d    ¡| t|ƒ¡t ¡t    j
krŠ| d
¡|  |¡}|  d ¡d   ¡}t d |›¡|S)z²
        Determines the path of the correct driver.
        :Args:
         - browser: which browser to get the driver path for.
        :Returns: The driver path to use
        zOApplicable driver not found; attempting to install with Selenium Manager (Beta)Z browserNamez    --browserz--outputÚjsonz--browser-versionÚbinary_locationNz--browser-pathz--debugú    éÿÿÿÿzUsing driver at: )ÚloggerÚinfoZ capabilitiesÚstrrZbrowser_versionÚappendÚgetattrÚgetEffectiveLevelÚloggingÚDEBUGÚrunÚsplitÚstripÚdebug)r    rZbrowserÚargsrÚresultÚ
executablerrr
Údriver_locationAs 
 
 
 
 
 
zSeleniumManager.driver_location)r-rcCsÒd |¡}t d|›¡tj|tjtjd}|j d¡ d¡}|j     d¡ d¡}t
  |¡}|dd}|j rˆt d|›d    |›|›ƒ‚nF|d
D]8}|d d kr®t |d¡|d d krt |d¡q|SdS)zÆ
        Executes the Selenium Manager Binary.
        :Args:
         - args: the components of the command being executed.
        :Returns: The log string containing the driver location.
        ú zExecuting process: )ÚstdoutÚstderrzutf-8Ú
r.ÚmessagezSelenium Manager failed for: z.
ZlogsÚlevelÚWARNr(N)Újoinr!r,Ú
subprocessr)ÚPIPEr2ÚdecodeÚrstripr3rÚloadsÚ
returncoderÚwarning)r-ÚcommandZcompleted_procr2r3Úoutputr.Úitemrrr
r)`s
 
    zSeleniumManager.run) Ú__name__Ú
__module__Ú __qualname__Ú__doc__r Ú staticmethodrrrr#r0rr)rrrr
rsr)rr'r9rÚpathlibrÚtypingrZselenium.common.exceptionsrZ!selenium.webdriver.common.optionsrÚ    getLoggerrCr!rrrrr
Ú<module>s