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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
U
\±d£#ã@s^ddlZddlmZddlmZddlmZddlmZGdd„dedZGd    d
„d
eƒZ    dS) éN)ÚABCMeta)Úabstractmethod)ÚInvalidArgumentException)ÚProxycsìeZdZdZddœ‡fdd„ Zedd„ƒZddœdd    „Zeedœd
d „ƒZ    e    j
edd œd d „ƒZ    eedœdd„ƒZ e j
eddœdd„ƒZ eedœdd„ƒZ e j
eddœdd„ƒZ eedœdd„ƒZ e j
eddœdd„ƒZ eedœdd„ƒZej
eddœdd„ƒZd2ejeejeejeddœdd „Zeedœd!d"„ƒZej
edd#œd$d"„ƒZeedœd%d&„ƒZej
edd#œd'd&„ƒZeedœd(d)„ƒZej
edd#œd*d)„ƒZeedœd+d,„ƒZej
edd#œd-d,„ƒZed.d/„ƒZeed0d1„ƒƒZ‡ZS)3Ú BaseOptionsz*Base class for individual browser options.N©Úreturncs(tƒ ¡|j|_| dd¡d|_dS)NÚpageLoadStrategyÚnormal)ÚsuperÚ__init__Údefault_capabilitiesÚ_capsÚset_capabilityÚmobile_options©Úself©Ú    __class__©úXd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/common/options.pyr s
 zBaseOptions.__init__cCs|jS©N©rrrrrÚ capabilities"szBaseOptions.capabilitiescCs||j|<dS)zSets a capability.Nr)rÚnameÚvaluerrrr&szBaseOptions.set_capabilitycCs |j d¡S)zN
        :returns: the version of the browser if set, otherwise None.
        ÚbrowserVersion©rÚgetrrrrÚbrowser_version*szBaseOptions.browser_version)ÚversionrcCs| d|¡dS)zÆRequires the major version of the browser to match provided value:
        https://w3c.github.io/webdriver/#dfn-browser-version.
 
        :param version: The required version of the browser
        rN©r)rr rrrr1scCs
|jdS)z4
        :returns: The name of the platform
        Ú platformNamerrrrrÚ platform_name:szBaseOptions.platform_name)ÚplatformrcCs| d|¡dS)z³Requires the platform to match the provided value:
        https://w3c.github.io/webdriver/#dfn-platform-name.
 
        :param platform: the required name of the platform
        r"Nr!)rr$rrrr#AscCs
|jdS)zN
        :returns: page load strategy if set, the default is "normal"
        r    rrrrrÚpage_load_strategyJszBaseOptions.page_load_strategy)ÚstrategyrcCs"|dkr| d|¡ntdƒ‚dS)zçDetermines the point at which a navigation command is returned:
        https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies.
 
        :param strategy: the strategy corresponding to a document readiness state
        )r
ÚeagerÚnoner    z>Strategy can only be one of the following: normal, eager, noneN©rÚ
ValueError)rr&rrrr%QscCs
|jdS)za
        :returns: unhandled prompt behavior if set, the default is "dismiss and notify"
        ÚunhandledPromptBehaviorrrrrrÚunhandled_prompt_behavior]sz%BaseOptions.unhandled_prompt_behavior)ÚbehaviorrcCs"|dkr| d|¡ntdƒ‚dS)a
How the driver should respond when an alert is present and the
        command sent is not handling the alert:
        https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies.
 
        :param behavior: behavior to use when an alert is encountered
        )ZdismissÚacceptzdismiss and notifyzaccept and notifyÚignorer+ziBehavior can only be one of the following: dismiss, accept, dismiss and notify, accept and notify, ignoreNr))rr-rrrr,ds
ÿcCs
|jdS)zu
        :returns: Values for implicit timeout, pageLoad timeout and script timeout if set (in milliseconds)
        Útimeoutsrrrrrr0tszBaseOptions.timeouts)r0rcCs0tdd„| ¡Dƒƒr$| d|¡ntdƒ‚dS)zîHow long the driver should wait for actions to complete before
        returning an error https://w3c.github.io/webdriver/#timeouts.
 
        :param timeouts: values in milliseconds for implicit wait, page load and script timeout
        css|]}|dkVqdS))ZimplicitZpageLoadÚscriptNr)Ú.0ÚxrrrÚ    <genexpr>‚sz'BaseOptions.timeouts.<locals>.<genexpr>r0zITimeout keys can only be one of the following: implicit, pageLoad, scriptN)ÚallÚkeysrr*)rr0rrrr0{s)Úandroid_packageÚandroid_activityÚ device_serialrcCs6|s tdƒ‚d|i|_|r$||jd<|r2||jd<dS)z˜Enables mobile browser use for browsers that support it.
 
        :Args:
            android_activity: The name of the android package to start
        z!android_package must be passed inZandroidPackageZandroidActivityZandroidDeviceSerialN)ÚAttributeErrorr)rr7r8r9rrrÚ enable_mobile‡s 
 
zBaseOptions.enable_mobilecCs|j dd¡S)zM
        :returns: whether the session accepts insecure certificates
        ÚacceptInsecureCertsFrrrrrÚaccept_insecure_certsšsz!BaseOptions.accept_insecure_certs)rrcCs||jd<dS)zãWhether untrusted and self-signed TLS certificates are implicitly
        trusted: https://w3c.github.io/webdriver/#dfn-insecure-tls-
        certificates.
 
        :param value: whether to accept insecure certificates
        r<Nr©rrrrrr=¡scCs|j dd¡S)zP
        :returns: whether session is strict about file interactability
        ÚstrictFileInteractabilityFrrrrrÚstrict_file_interactability«sz'BaseOptions.strict_file_interactabilitycCs||jd<dS)z°Whether interactability checks will be applied to file type input
        elements. The default is false.
 
        :param value: whether file interactability is strict
        r?Nrr>rrrr@²scCs|j dd¡S)z\
        :returns: whether the remote end supports setting window size and position
        Ú setWindowRectFrrrrrÚset_window_rect»szBaseOptions.set_window_rectcCs||jd<dS)a Whether the remote end supports all of the resizing and positioning
        commands. The default is false. https://w3c.github.io/webdriver/#dfn-
        strict-file-interactability.
 
        :param value: whether remote end must support setting window resizing and repositioning
        rANrr>rrrrBÂscCs|jS)z9
        :Returns: Proxy if set, otherwise None.
        )Ú_proxyrrrrÚproxyÌszBaseOptions.proxycCst|tƒstdƒ‚||_dS)Nz$Only Proxy objects can be passed in.)Ú
isinstancerrrCr>rrrrDÓs
cCsdS)z-Convert options into capabilities dictionary.NrrrrrÚto_capabilitiesÙszBaseOptions.to_capabilitiescCsdS)z6Return minimal capabilities necessary as a dictionary.Nrrrrrr Ýsz BaseOptions.default_capabilities)NNN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r ÚpropertyrrÚstrrÚsetterr#r%r,Údictr0ÚtypingÚOptionalr;Úboolr=r@rBrrDrrFr Ú __classcell__rrrrrsn
  üû         
r)Ú    metaclasscsXeZdZddœ‡fdd„ Zedd„ƒZdd„Zddœd    d
„Zd d „Zed d„ƒZ    ‡Z
S)Ú
ArgOptionsNrcstƒ ¡g|_d|_dS)NF)r r Ú
_argumentsÚ_ignore_local_proxyrrrrr äs
zArgOptions.__init__cCs|jS)zF
        :Returns: A list of arguments needed for the browser
        )rUrrrrÚ    argumentsészArgOptions.argumentscCs|r|j |¡ntdƒ‚dS)zTAdds an argument to the list.
 
        :Args:
         - Sets the arguments
        zargument can not be nullN)rUÚappendr*)rZargumentrrrÚ add_argumentðszArgOptions.add_argumentcCs
d|_dS)zaBy calling this you will ignore HTTP_PROXY and HTTPS_PROXY from
        being picked up and used.TN)rVrrrrÚ(ignore_local_proxy_environment_variablesûsz3ArgOptions.ignore_local_proxy_environment_variablescCs|jSrrrrrrrFszArgOptions.to_capabilitiescCsiSrrrrrrr szArgOptions.default_capabilities) rGrHrIr rKrWrYrZrFr rRrrrrrTãs
 rT)
rOÚabcrrZselenium.common.exceptionsrZselenium.webdriver.common.proxyrrrTrrrrÚ<module>s    K