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
103
104
105
106
107
108
109
110
111
112
113
U
[±d°$ã@spddlZddlmZddlmZddlmZddlm    Z    ddl
mZ ddl m ZdZdZdZGdd„deƒZdS)    éN)ÚOptions)ÚChromiumRemoteConnection)Ú BaseOptions)ÚService)Ú    WebDrivercsþeZdZdZedddedefeeddœ‡fdd„ Z    dd„Z
dd    „Z dd
œd d „Z dd
œd d„Z eeddœdd„Zeedœdd„Zed
œdd„Zdd„Zeedœdd„Zeedœdd„Zeedœdd„Zeedœd d!„Zdd
œ‡fd"d#„ Zed
œd$d%„Z‡ZS)&ÚChromiumDriverzZControls the WebDriver instance of ChromiumDriver and allows you to
    drive the browser.N)ÚoptionsÚserviceÚreturnc
s&|rtjdtdd|tkr,tjdtdd||_|tkrJtjdtdd|    tkrpt|ƒˆkrptjdtddnd}    ||_d}
|sŠ|     ¡}|r¬| 
¡D]\} } |  | | ¡q–|j r¸|j }
|sÄt d    ƒ‚||_|j ¡z&tƒjt|jj|||    |
d
|d Wn tk
r| ¡‚YnXd |_dS) 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 objectTNzservice cannot be None)Zremote_server_addrÚ browser_nameÚ vendor_prefixÚ
keep_aliveZ ignore_proxy)Zcommand_executorrF)ÚwarningsÚwarnÚDeprecationWarningÚ DEFAULT_PORTÚportÚDEFAULT_SERVICE_LOG_PATHÚDEFAULT_KEEP_ALIVEÚtyperÚcreate_optionsÚitemsZset_capabilityZ_ignore_local_proxyÚAttributeErrorr    ÚstartÚsuperÚ__init__rZ service_urlÚ    ExceptionÚquitZ
_is_remote) Úselfr rrrZ service_argsZdesired_capabilitiesZservice_log_pathr    rZ _ignore_proxyÚkeyÚvalue©Ú    __class__©ú\d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/chromium/webdriver.pyr$sdýýÿ
ûø
 
zChromiumDriver.__init__cCs| dd|i¡S)z&Launches Chromium app specified by id.Z    launchAppÚid©Úexecute)r r'r%r%r&Ú
launch_appwszChromiumDriver.launch_appcCs| d¡dS)zÑGets Chromium network emulation settings.
 
        :Returns:
            A dict. For example:
            {'latency': 4, 'download_throughput': 2, 'upload_throughput': 2,
            'offline': False}
        ZgetNetworkConditionsr"r(©r r%r%r&Úget_network_conditions{sz%ChromiumDriver.get_network_conditions)r
cKs| dd|i¡dS)aSets 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).
        ZsetNetworkConditionsÚnetwork_conditionsNr()r r-r%r%r&Úset_network_conditions…sz%ChromiumDriver.set_network_conditionscCs| d¡dS)z+Resets Chromium network emulation settings.ZdeleteNetworkConditionsNr(r+r%r%r&Údelete_network_conditions˜sz(ChromiumDriver.delete_network_conditions)Únamer"r
cCs| dd|i|dœ¡dS)zú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')
        ZsetPermissionsr0)Z
descriptorÚstateNr()r r0r"r%r%r&Úset_permissionsœs zChromiumDriver.set_permissions)ÚcmdÚcmd_argscCs| d||dœ¡dS)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'}
        ZexecuteCdpCommand)r3Úparamsr"r()r r3r4r%r%r&Úexecute_cdp_cmd©szChromiumDriver.execute_cdp_cmdcCs| d¡dS)z?
        :Returns: A list of sinks available for Cast.
        ZgetSinksr"r(r+r%r%r&Ú    get_sinks¼szChromiumDriver.get_sinkscCs| d¡dS)zW
        :Returns: An error message when there is any issue in a Cast session.
        ZgetIssueMessager"r(r+r%r%r&Úget_issue_messageÂsz ChromiumDriver.get_issue_message)Ú    sink_namer
cCs| dd|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.
        Z setSinkToUseÚsinkNamer(©r r9r%r%r&Úset_sink_to_useÈszChromiumDriver.set_sink_to_usecCs| dd|i¡S)z—Starts a desktop mirroring session on a specific receiver target.
 
        :Args:
         - sink_name: Name of the sink to use as the target.
        ZstartDesktopMirroringr:r(r;r%r%r&Ústart_desktop_mirroringÑsz&ChromiumDriver.start_desktop_mirroringcCs| dd|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.
        ZstartTabMirroringr:r(r;r%r%r&Ústart_tab_mirroringÙsz"ChromiumDriver.start_tab_mirroringcCs| dd|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.
        Z stopCastingr:r(r;r%r%r&Ú stop_castingászChromiumDriver.stop_castingcs:z(ztƒ ¡Wntk
r$YnXW5|j ¡XdS)zyCloses the browser and shuts down the ChromiumDriver executable that
        is started when starting the ChromiumDriver.N)r    Ústoprrrr+r#r%r&rés
 
zChromiumDriver.quitcCs|jdkrtƒStƒS)NÚms)rÚ EdgeOptionsÚ ChromeOptionsr+r%r%r&rôszChromiumDriver.create_options)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrrrrr*r,r.r/Ústrr2Údictr6Úlistr7r8r<r=r>r?rrÚ __classcell__r%r%r#r&r s6öõS
      r)rZ!selenium.webdriver.chrome.optionsrrCZ-selenium.webdriver.chromium.remote_connectionrZ!selenium.webdriver.common.optionsrZ!selenium.webdriver.common.servicerZselenium.webdriver.edge.optionsrBZ#selenium.webdriver.remote.webdriverrZRemoteWebDriverrrrrr%r%r%r&Ú<module>s