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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
U
[±dÂã@shddlZddlZddlZddlmZddlmZddlmZddlmZddl    m
Z
Gdd„de
ƒZ dS)    éN)ÚBinaryIO)ÚList)ÚUnion)ÚDesiredCapabilities)Ú
ArgOptionscs(eZdZdZddœ‡fdd„ Zeedœdd„ƒZejeddœd    d„ƒZeedœd
d „ƒZ    e    jeddœd d „ƒZ    ee
edœd d„ƒZ eddœdd„Z eddœdd„Z eedœdd„ƒZeeeeee
efddœdd„Zeedœdd„ƒZejeddœdd„ƒZedœdd„Zeedœdd„ƒZ‡ZS) ÚChromiumOptionszgoog:chromeOptionsN)Úreturncs,tƒ ¡d|_g|_g|_i|_d|_dS)NÚ)ÚsuperÚ__init__Ú_binary_locationÚ_extension_filesÚ _extensionsÚ_experimental_optionsÚ_debugger_address©Úself©Ú    __class__©úZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/chromium/options.pyr  s 
zChromiumOptions.__init__cCs|jS)zQ
        :Returns: The location of the binary, otherwise an empty string
        ©r rrrrÚbinary_location(szChromiumOptions.binary_location)ÚvaluercCs
||_dS)z€
        Allows you to set where the chromium binary lives
        :Args:
         - value: path to the Chromium binary
        Nr©rrrrrr/scCs|jS)zG
        :Returns: The address of the remote devtools instance
        ©rrrrrÚdebugger_address8sz ChromiumOptions.debugger_addresscCs
||_dS)a
 
        Allows you to set the address of the remote devtools instance
        that the ChromeDriver instance will try to connect to during an
        active wait.
        :Args:
         - value: address of remote devtools instance if any (hostname[:port])
        Nrrrrrr?s    c
CsNttdœdd„}g}|jD](}t|dƒ}| ||ƒ¡W5QRXq||jS)zL
        :Returns: A list of encoded extensions that will be loaded
        )Ú    file_datarcSst | ¡¡ d¡S)Nzutf-8)Úbase64Ú    b64encodeÚreadÚdecode)rrrrÚ_decodePsz+ChromiumOptions.extensions.<locals>._decodeÚrb)rÚstrr ÚopenÚappendr)rr"Zencoded_extensionsÚ    extensionÚfrrrÚ
extensionsJs 
 zChromiumOptions.extensions)r'rcCsH|r<tj tj |¡¡}tj |¡r2|j |¡qDtdƒ‚ntdƒ‚dS)z¬Adds the path to the extension to a list that will be used to
        extract it to the ChromeDriver.
 
        :Args:
         - extension: path to the \*.crx file
        z#Path to the extension doesn't existúargument can not be nullN)    ÚosÚpathÚabspathÚ
expanduserÚexistsr r&ÚOSErrorÚ
ValueError)rr'Zextension_to_addrrrÚ add_extension]s  
zChromiumOptions.add_extensioncCs|r|j |¡ntdƒ‚dS)zÎAdds Base64 encoded string with extension data to a list that will
        be used to extract it to the ChromeDriver.
 
        :Args:
         - extension: Base64 encoded string with extension data
        r*N)rr&r1)rr'rrrÚadd_encoded_extensionmsz%ChromiumOptions.add_encoded_extensioncCs|jS)zM
        :Returns: A dictionary of experimental options for chromium
        )rrrrrÚexperimental_optionsysz$ChromiumOptions.experimental_options)ÚnamerrcCs<| ¡dkr.|dks|dkr.tjtdƒdd||j|<dS)z¢Adds an experimental option which is passed to chromium.
 
        :Args:
          name: The experimental option name.
          value: The option value.
        Úw3cÚfalseFz<Manipulating `w3c` setting can have unintended consequences.é©Ú
stacklevelN)ÚlowerÚwarningsÚwarnÚ UserWarningr)rr5rrrrÚadd_experimental_option€sz'ChromiumOptions.add_experimental_optioncCstjdtddd|jkS)zL
        :Returns: True if the headless argument is set, else False
        zLheadless property is deprecated, instead check for '--headless' in argumentsr8r9ú
--headless)r<r=ÚDeprecationWarningÚ
_argumentsrrrrÚheadless‹s ýzChromiumOptions.headlesscCsDtjdtdddh}|dkr,|j |¡ntt|jƒ|ƒ|_dS)aPSets the headless argument Old headless uses a non-production
        browser and is set with `--headless`
 
        Native headless from v86 - v108 is set with `--headless=chrome`
        Native headless from v109+ is set with `--headless=new`
        :Args:
          value: boolean value indicating to set the headless option
        ziheadless property is deprecated, instead use add_argument('--headless') or add_argument('--headless=new')r8r9r@TN)r<r=rArBÚextendÚlistÚset)rrÚargsrrrrC—s
ýcCsŽ|j}|j ¡}d|kr:|dr2tjdtddntdƒ‚|jrL| |j¡|j    |d<|j
rf|j
|d<|j |d<|j r€|j |d    <|||j <|S)
z
        Creates a capabilities with all the options that have been set
        :Returns: A dictionary with everything
        r6z>Setting 'w3c: True' is redundant and will no longer be allowedr8r9z}setting w3c to False is not allowed, Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/r)ÚbinaryrGZdebuggerAddress)Z_capsr4Úcopyr<r=rAÚAttributeErrorZmobile_optionsÚupdater)rrBrÚKEY)rZcapsZchrome_optionsrrrÚto_capabilities¬s,
ÿÿ 
 
 
 
 
zChromiumOptions.to_capabilitiescCs
tj ¡S)N)rZCHROMErIrrrrÚdefault_capabilitiesËsz$ChromiumOptions.default_capabilities)Ú__name__Ú
__module__Ú __qualname__rLr Úpropertyr$rÚsetterrrr)r2r3Údictr4rÚintr?ÚboolrCrMrNÚ __classcell__rrrrrs0
 "  r) rr+r<ÚtypingrrrZ.selenium.webdriver.common.desired_capabilitiesrZ!selenium.webdriver.common.optionsrrrrrrÚ<module>s