zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
U
\±d#©ã @sZdZddlZddlZddlZddlZddlZddlZddlmZddl    m
Z
ddl    m Z ddlm Z ddlm Z ddlmZdd    lmZdd
lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl"m#Z#ddl$m%Z%ddl$m&Z&ddl$m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1dd l0m2Z2dd!l3m4Z4dd"l5m6Z6dd#l7m8Z8dd$l9m:Z:dd%l;m<Z<dd&l=m>Z>e?d'd(d)d*d+d,d-d.d/d0d1g ƒZ@d'd)d+d2œZAdaBd3d4„ZCd5d6„ZDdBd8d9„ZEeeed:œd;d<„ZFGd=d>„d>ed?ZGGd@dA„dAeGƒZHdS)CzThe WebDriver implementation.éN)ÚABCMeta)Ú    b64decode)Úurlsafe_b64encode)Úasynccontextmanager)Úcontextmanager)Ú import_module)ÚDict)ÚList)ÚOptional)ÚUnion)ÚInvalidArgumentException)ÚJavascriptException)ÚNoSuchCookieException)ÚNoSuchElementException)ÚWebDriverException)ÚBy©ÚApplicationCache)Ú BaseOptions)Ú PrintOptions)ÚTimeouts)Ú
Credential)ÚVirtualAuthenticatorOptions)Úrequired_virtual_authenticator)Ú
RelativeByé)ÚBidiConnection)ÚCommand)Ú ErrorHandler)Ú FileDetector)ÚLocalFileDetector)ÚMobile)ÚRemoteConnection)Ú    ScriptKey)Ú
ShadowRoot)ÚSwitchTo)Ú
WebElementZacceptInsecureCertsÚ browserNameZbrowserVersionZpageLoadStrategyZ platformNameÚproxyZ setWindowRectZstrictFileInteractabilityÚtimeoutsZunhandledPromptBehaviorZ webSocketUrl)ZacceptSslCertsÚversionÚplatformcCsts tdƒadS)Nz"selenium.webdriver.common.bidi.cdp)Úcdpr©r-r-úZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/remote/webdriver.pyÚ
import_cdpVsr/cCsøt |¡}| d¡}i}| d¡rH|d d¡rH|dd ¡|dd<| ¡D]h\}}|r |tkr t|}tj|›d|›dtdd|dkr˜| ¡n|||<|t    ks°d    |krP|||<qP|rì| d
i¡}d |krìt |¡}||d <||d
<ig|d œS) aMakes a W3C alwaysMatch capabilities object.
 
    Filters out capability names that are not in the W3C spec. Spec-compliant
    drivers will reject requests containing unknown capability names.
 
    Moves the Firefox profile, if present, from the old location to the new Firefox
    options object.
 
    :Args:
     - caps - A dictionary of capabilities requested by the caller.
    Úfirefox_profiler(Z    proxyTypez  is not a w3c capability.  use `z5` instead.  This will no longer be converted in 4.7.0é©Ú
stacklevelr+ú:úmoz:firefoxOptionsÚprofile)Ú
firstMatchÚ alwaysMatch)
ÚcopyÚdeepcopyÚgetÚlowerÚitemsÚ_OSS_W3C_CONVERSIONÚwarningsÚwarnÚDeprecationWarningÚ_W3C_CAPABILITY_NAMES)Úcapsr6Z always_matchÚkÚvZw3c_equivalentZmoz_optsZnew_optsr-r-r.Ú_make_w3c_caps\s.
 
 ü
 
rFFc    sVddlm}ddlm}ddlm}t|||g}t‡fdd„|Dƒtƒ}||||dS)Nr)ÚChromiumRemoteConnection)ÚFirefoxRemoteConnection)ÚSafariRemoteConnectionc3s"|]}|jˆ d¡kr|VqdS)r'N)Z browser_namer;)Ú.0Úc©Ú capabilitiesr-r.Ú    <genexpr>‹sz(get_remote_connection.<locals>.<genexpr>)Ú
keep_aliveZ ignore_proxy)Z-selenium.webdriver.chromium.remote_connectionrGZ,selenium.webdriver.firefox.remote_connectionrHZ+selenium.webdriver.safari.remote_connectionrIr"Únext)    rMÚcommand_executorrOÚignore_local_proxyrGrHrIÚ
candidatesÚhandlerr-rLr.Úget_remote_connection…s     rU©ÚoptionsÚreturnc Csþdii}g}|D]}| | ¡¡qt|ƒ}i}t|ƒD]p}|}|d|kr8|| ¡}|D]J}    |    ||d ¡kr\|||    ||d|    kr\| |    |||    i¡q\q8i}
| ¡D]\} } | |
| <q¶|D]}|
D]
} || =qÔqÌ|
|dd<||dd<|S)NrMrr8r7)ÚappendÚto_capabilitiesÚlenÚrangeÚkeysÚupdater=) rWrMÚoptsÚoptZ    opts_sizeZsamesiesÚiZ    min_indexZ
first_keysZkysÚalwaysrDrEr-r-r.Úcreate_matchess.   
 
  rcc@seZdZdZdS)Ú BaseWebDriverz«Abstract Base Class for all Webdriver subtypes.
 
    ABC's allow custom implementations of Webdriver to be registered so
    that isinstance type checks will succeed.
    N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r-r-r-r.rd²srd)Ú    metaclassc@seZdZdZeZeZd¬ee    e
e    fddœdd„Z dd    „Z d
d „Z ejejeejeejejd œd d„Zedd„ƒZeedœdd„ƒZeedœdd„ƒZdd„Zdd„Zd­eddœdd„Zdd„Z eedœd d!„Z!d"d#„Z"d®eeed$œd%d&„Z#edd'œd(d)„Z$eedœd*d+„ƒZ%d¯ee&d,œd-d.„Z'e&dd/œd0d1„Z(e
edœd2d3„Z)d4d5„Z*ed6œd7d8„Z+eedœd9d:„ƒZ,eedœd;d<„ƒZ-ddœd=d>„Z.ddœd?d@„Z/eedœdAdB„ƒZ0ee
edœdCdD„ƒZ1ddœdEdF„Z2ddœdGdH„Z3ddœdIdJ„Z4d°ee5edKœdLdM„Z6ee7dœdNdO„ƒZ8ddœdPdQ„Z9ddœdRdS„Z:ddœdTdU„Z;e
edœdVdW„Z<ejej=dœdXdY„Z>ddœdZd[„Z?ddœd\d]„Z@ddœd^d_„ZAeBdd`œdadb„ZCeBdd`œdcdd„ZDeBdd`œdedf„ZEeeFdœdgdh„ƒZGeGjHddœdidh„ƒZGeIjJdfeeedjœdkdl„ZKeIjJdfeee
edjœdmdn„ZLeedœdodp„ƒZMeedœdqdr„ƒZNeOdœdsdt„ZPeOdœdudv„ZQeRdœdwdx„ZSedœdydz„ZTd±edd|œd}d~„ZUd²eed|œdd€„ZVd³eed|œdd‚„ZWd´edœdƒd„„ZXedœd…d†„ZYdµedœd‡dˆ„ZZee[dœd‰dŠ„ƒZ\e\jHddœd‹dŠ„ƒZ\edŒd„ƒZ]e]jHddœdŽd„ƒZ]edd„ƒZ^ed‘d’„ƒZ_d“d”„Z`ead•d–„ƒZbd—d˜„Zcedddœd™dš„Zeeedœd›dœ„ƒZfegddœddž„ƒZhegeiddŸœd d¡„ƒZjege
eidœd¢d£„ƒZkegeeelfdd¤œd¥d¦„ƒZmegddœd§d¨„ƒZnegeOdd©œdªd«„ƒZodS)¶Ú    WebDriveraµControls a browser by sending commands to a remote server. This server
    is expected to be running the WebDriver wire protocol as defined at
    https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol.
 
    :Attributes:
     - session_id - String ID of the browser session started and controlled by this WebDriver.
     - capabilities - Dictionary of effective capabilities of this browser session as returned
         by the remote server. See https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
     - command_executor - remote_connection.RemoteConnection object used to execute commands.
     - error_handler - errorhandler.ErrorHandler object used to handle errors.
    úhttp://127.0.0.1:4444NTrVc
Cs&|rtjdtdd|r(tjdtdd|r<tjdtdd|sPtjdtddi}t|tƒrht|ƒ}n6d}    |r~| ¡}|j}    |ržt|tƒs”t    dƒ‚| 
|¡||_ t|j t t fƒrÆt||||    d    |_ d
|_d |_i|_i|_tƒ|_t|ƒ|_t|ƒ|_|ptƒ|_d |_| ¡| ||¡d S) aWCreate a new driver that will issue commands using the wire
        protocol.
 
        :Args:
         - command_executor - Either a string representing URL of the remote server or a custom
             remote_connection.RemoteConnection object. Defaults to 'http://127.0.0.1:4444/wd/hub'.
         - desired_capabilities - A dictionary of capabilities to request when
             starting the browser session. Required parameter.
         - browser_profile - A selenium.webdriver.firefox.firefox_profile.FirefoxProfile object.
             Only used if Firefox is requested. Optional.
         - proxy - A selenium.webdriver.common.proxy.Proxy object. The browser session will
             be started with given proxy settings, if possible. Optional.
         - keep_alive - Whether to configure remote_connection.RemoteConnection to use
             HTTP keep-alive. Defaults to True.
         - file_detector - Pass custom file detector object during instantiation. If None,
             then default LocalFileDetector() will be used.
         - options - instance of a driver options.Options class
        z]desired_capabilities has been deprecated, please pass in an Options object with options kwargr1r2z`browser_profile has been deprecated, please pass in an Firefox Options object with options kwargzNproxy has been deprecated, please pass in an Options object with options kwargzckeep_alive has been deprecated. We will be using True as the default value as we start removing it.Fz)Desired Capabilities must be a dictionary)rQrOrRTN)r?r@rAÚ
isinstanceÚlistrcrZÚ_ignore_local_proxyÚdictrr^rQÚstrÚbytesrUZ
_is_remoteÚ
session_idrCÚpinned_scriptsrÚ error_handlerr%Ú
_switch_tor!Ú_mobiler Ú file_detectorÚ_authenticator_idÚ start_clientÚ start_session)
ÚselfrQÚdesired_capabilitiesÚbrowser_profiler(rOrwrWrMrnr-r-r.Ú__init__Êslýýýý
 
 
 
ü
 
zWebDriver.__init__cCs&dt|ƒj›dt|ƒj›d|j›dS)Nú<Ú.z  (session="z")>)Útyperfrerr©r{r-r-r.Ú__repr__ szWebDriver.__repr__cCs|S©Nr-r‚r-r-r.Ú    __enter__#szWebDriver.__enter__)Úexc_typeÚexcÚ    tracebackcCs | ¡dSr„)Úquit)r{r†r‡rˆr-r-r.Ú__exit__&szWebDriver.__exit__cos>d}t|j|ƒs"|j}|||Ž|_z
dVW5|r8||_XdS)aíOverrides the current file detector (if necessary) in limited
        context. Ensures the original file detector is set afterwards.
 
        Example:
 
        with webdriver.file_detector_context(UselessFileDetector):
            someinput.send_keys('/etc/hosts')
 
        :Args:
         - file_detector_class - Class of the desired file detector. If the class is different
             from the current file_detector, then the class is instantiated with args and kwargs
             and used as a file detector during the duration of the context manager.
         - args - Optional arguments that get passed to the file detector class during
             instantiation.
         - kwargs - Keyword arguments, passed the same way as args.
        N)rlrw)r{Zfile_detector_classÚargsÚkwargsZ last_detectorr-r-r.Úfile_detector_context.s  
zWebDriver.file_detector_context)rXcCs|jSr„)rvr‚r-r-r.ÚmobileJszWebDriver.mobilecCs d|jkr|jdStdƒ‚dS)zŠReturns the name of the underlying browser for this instance.
 
        :Usage:
            ::
 
                name = driver.name
        r'z1browserName not specified in session capabilitiesN)rCÚKeyErrorr‚r-r-r.ÚnameNs    
 
zWebDriver.namecCsdS)zxCalled before starting a new session.
 
        This method may be overridden to define custom startup behavior.
        Nr-r‚r-r-r.ry[szWebDriver.start_clientcCsdS)z‚Called after executing a quit command.
 
        This method may be overridden to define custom shutdown
        behavior.
        Nr-r‚r-r-r.Ú stop_clientbszWebDriver.stop_client)rMrXcCs˜t|tƒstdƒ‚|r>d|kr.|j|dd<n| d|ji¡t|ƒ}d|i}| tj|¡}d|krl|d}|d|_    | 
d¡|_ |j s”| 
d¡|_ dS)    aCreates a new session with the desired capabilities.
 
        :Args:
         - capabilities - a capabilities dict to start the session with.
         - browser_profile - A selenium.webdriver.firefox.firefox_profile.FirefoxProfile object. Only used if Firefox is requested.
        z!Capabilities must be a dictionaryr5r6r0rMÚ    sessionIdÚvalueN) rlror Úencodedr^rFÚexecuterZ NEW_SESSIONrrr;rC)r{rMr}Zw3c_capsÚ
parametersÚresponser-r-r.rzjs
 
 zWebDriver.start_sessioncs‚t|tƒr2i}| ¡D]\}}ˆ |¡||<q|St|ˆjƒrHd|jiSt|ˆjƒr^d|jiSt|tƒr~t‡fdd„|DƒƒS|S)Nú#element-6066-11e4-a52e-4f735466cecfú"shadow-6066-11e4-a52e-4f735466cecfc3s|]}ˆ |¡VqdSr„)Ú _wrap_value©rJÚitemr‚r-r.rNsz(WebDriver._wrap_value.<locals>.<genexpr>)rlror=ršÚ_web_element_clsÚidÚ_shadowroot_clsrm)r{r“Z    convertedÚkeyÚvalr-r‚r.rš…s
 
 
 
zWebDriver._wrap_value)Ú
element_idrXcCs | ||¡S)z6Creates a web element with the specified `element_id`.)r)r{r¢r-r-r.Úcreate_web_element“szWebDriver.create_web_elementcs€t|tƒr\d|kr ˆ |d¡Sd|kr8ˆ ˆ|d¡S| ¡D]\}}ˆ |¡||<q@|St|tƒr|t‡fdd„|DƒƒS|S)Nr˜r™c3s|]}ˆ |¡VqdSr„)Ú _unwrap_valuer›r‚r-r.rN¡sz*WebDriver._unwrap_value.<locals>.<genexpr>)rlror£rŸr=r¤rm)r{r“r r¡r-r‚r.r¤—s
 
zWebDriver._unwrap_value)Údriver_commandÚparamsrXcCsx| |¡}|jr2|s d|ji}nd|kr2|j|d<|j ||¡}|rj|j |¡| | dd¡¡|d<|Sdd|jdœS)aHSends a command to be executed by a command.CommandExecutor.
 
        :Args:
         - driver_command: The name of the command to execute as a string.
         - params: A dictionary of named parameters to send with the command.
 
        :Returns:
          The command's JSON response loaded into a dictionary object.
        r’r“Nr)Úsuccessr“r’)ršrrrQr•rtZcheck_responser¤r;)r{r¥r¦r—r-r-r.r•¤s
 
 
 zWebDriver.execute)ÚurlrXcCs| tjd|i¡dS)z0Loads a web page in the current browser session.r¨N)r•rÚGET)r{r¨r-r-r.r;¿sz WebDriver.getcCs| tj¡ dd¡S)zuReturns the title of the current page.
 
        :Usage:
            ::
 
                title = driver.title
        r“Ú)r•rZ    GET_TITLEr;r‚r-r-r.ÚtitleÃs    zWebDriver.title)ÚscriptrXcCst|ƒ}||j|j<|S)zUStore common javascript scripts to be executed later by a unique
        hashable ID.)r#rsrž)r{r¬Ú
script_keyZscript_key_instancer-r-r.Ú
pin_scriptÎs zWebDriver.pin_script)r­rXcCsDz|j |j¡Wn,tk
r>td|›d|j›ƒd‚YnXdS)z$Remove a pinned script from storage.zNo script with key: z  existed in N)rsÚpopržr)r{r­r-r-r.ÚunpinÕszWebDriver.unpincCs
t|jƒSr„)rmrsr‚r-r-r.Úget_pinned_scriptsÜszWebDriver.get_pinned_scriptscGs\t|tƒr8z|j|j}Wntk
r6tdƒ‚YnXt|ƒ}tj}|     |||dœ¡dS)a'Synchronously Executes JavaScript in the current window/frame.
 
        :Args:
         - script: The JavaScript to execute.
         - \*args: Any applicable arguments for your JavaScript.
 
        :Usage:
            ::
 
                driver.execute_script('return document.title;')
        z Pinned script could not be found©r¬r‹r“)
rlr#rsržrr rmrZW3C_EXECUTE_SCRIPTr•©r{r¬r‹Zconverted_argsÚcommandr-r-r.Úexecute_scriptßs
zWebDriver.execute_script)r¬cGs$t|ƒ}tj}| |||dœ¡dS)aÁAsynchronously Executes JavaScript in the current window/frame.
 
        :Args:
         - script: The JavaScript to execute.
         - \*args: Any applicable arguments for your JavaScript.
 
        :Usage:
            ::
 
                script = "var callback = arguments[arguments.length - 1]; " \
                         "window.setTimeout(function(){ callback('timeout') }, 3000);"
                driver.execute_async_script(script)
        r²r“)rmrZW3C_EXECUTE_SCRIPT_ASYNCr•r³r-r-r.Úexecute_async_scriptöszWebDriver.execute_async_scriptcCs| tj¡dS)znGets the URL of the current page.
 
        :Usage:
            ::
 
                driver.current_url
        r“)r•rZGET_CURRENT_URLr‚r-r-r.Ú current_url    s    zWebDriver.current_urlcCs| tj¡dS)zqGets the source of the current page.
 
        :Usage:
            ::
 
                driver.page_source
        r“)r•rZGET_PAGE_SOURCEr‚r-r-r.Ú page_sources    zWebDriver.page_sourcecCs| tj¡dS)zcCloses the current window.
 
        :Usage:
            ::
 
                driver.close()
        N)r•rZCLOSEr‚r-r-r.ÚcloseszWebDriver.closecCs*z| tj¡W5| ¡|j ¡XdS)z|Quits the driver and closes every associated window.
 
        :Usage:
            ::
 
                driver.quit()
        N)r‘rQr¹r•rZQUITr‚r-r-r.r‰)szWebDriver.quitcCs| tj¡dS)z€Returns the handle of the current window.
 
        :Usage:
            ::
 
                driver.current_window_handle
        r“)r•rZW3C_GET_CURRENT_WINDOW_HANDLEr‚r-r-r.Úcurrent_window_handle7s    zWebDriver.current_window_handlecCs| tj¡dS)zŽReturns the handles of all windows within the current session.
 
        :Usage:
            ::
 
                driver.window_handles
        r“)r•rZW3C_GET_WINDOW_HANDLESr‚r-r-r.Úwindow_handlesBs    zWebDriver.window_handlescCstj}| |d¡dS)z5Maximizes the current window that webdriver is using.N)rZW3C_MAXIMIZE_WINDOWr•)r{r´r-r-r.Úmaximize_windowMszWebDriver.maximize_windowcCs| tj¡dS)z<Invokes the window manager-specific 'full screen' operation.N)r•rZFULLSCREEN_WINDOWr‚r-r-r.Úfullscreen_windowRszWebDriver.fullscreen_windowcCs| tj¡dS)z9Invokes the window manager-specific 'minimize' operation.N)r•rZMINIMIZE_WINDOWr‚r-r-r.Úminimize_windowVszWebDriver.minimize_window)Ú print_optionsrXcCs"i}|r| ¡}| tj|¡dS)z‰Takes PDF of the current page.
 
        The driver makes a best effort to return a PDF based on the
        provided parameters.
        r“)Úto_dictr•rZ
PRINT_PAGE)r{r¿rWr-r-r.Ú
print_pageZszWebDriver.print_pagecCs|jS)a<
        :Returns:
            - SwitchTo: an object containing all options to switch focus into
 
        :Usage:
            ::
 
                element = driver.switch_to.active_element
                alert = driver.switch_to.alert
                driver.switch_to.default_content()
                driver.switch_to.frame('frame_name')
                driver.switch_to.frame(1)
                driver.switch_to.frame(driver.find_elements(By.TAG_NAME, "iframe")[0])
                driver.switch_to.parent_frame()
                driver.switch_to.window('main')
        )rur‚r-r-r.Ú    switch_tofszWebDriver.switch_tocCs| tj¡dS)zvGoes one step backward in the browser history.
 
        :Usage:
            ::
 
                driver.back()
        N)r•rZGO_BACKr‚r-r-r.Úback{szWebDriver.backcCs| tj¡dS)zxGoes one step forward in the browser history.
 
        :Usage:
            ::
 
                driver.forward()
        N)r•rZ
GO_FORWARDr‚r-r-r.Úforward…szWebDriver.forwardcCs| tj¡dS)zfRefreshes the current page.
 
        :Usage:
            ::
 
                driver.refresh()
        N)r•rZREFRESHr‚r-r-r.ÚrefreshszWebDriver.refreshcCs| tj¡dS)z®Returns a set of dictionaries, corresponding to cookies visible in
        the current session.
 
        :Usage:
            ::
 
                driver.get_cookies()
        r“)r•rZGET_ALL_COOKIESr‚r-r-r.Ú get_cookiesšs    zWebDriver.get_cookiesc
Cs8t t¡$| tjd|i¡dW5QR£SQRXdS)z§Get a single cookie by name. Returns the cookie if found, None if
        not.
 
        :Usage:
            ::
 
                driver.get_cookie('my_cookie')
        rr“N)Ú
contextlibÚsuppressrr•rZ
GET_COOKIE©r{rr-r-r.Ú
get_cookie¥s     (zWebDriver.get_cookiecCs| tjd|i¡dS)zˆDeletes a single cookie with the given name.
 
        :Usage:
            ::
 
                driver.delete_cookie('my_cookie')
        rN)r•rZ DELETE_COOKIErÉr-r-r.Ú delete_cookie²szWebDriver.delete_cookiecCs| tj¡dS)z…Delete all cookies in the scope of the session.
 
        :Usage:
            ::
 
                driver.delete_all_cookies()
        N)r•rZDELETE_ALL_COOKIESr‚r-r-r.Údelete_all_cookies¼szWebDriver.delete_all_cookiescCsBd|kr,|ddkst‚| tjd|i¡n| tjd|i¡dS)aAAdds a cookie to your current session.
 
        :Args:
         - cookie_dict: A dictionary object, with required keys - "name" and "value";
            optional keys - "path", "domain", "secure", "httpOnly", "expiry", "sameSite"
 
        Usage:
            driver.add_cookie({'name' : 'foo', 'value' : 'bar'})
            driver.add_cookie({'name' : 'foo', 'value' : 'bar', 'path' : '/'})
            driver.add_cookie({'name' : 'foo', 'value' : 'bar', 'path' : '/', 'secure':True})
            driver.add_cookie({'name': 'foo', 'value': 'bar', 'sameSite': 'Strict'})
        ZsameSite)ZStrictZLaxÚNoneÚcookieN)ÚAssertionErrorr•rZ
ADD_COOKIE)r{Ú cookie_dictr-r-r.Ú
add_cookieÆs zWebDriver.add_cookie)Ú time_to_waitrXcCs"| tjdtt|ƒdƒi¡dS)a Sets a sticky timeout to implicitly wait for an element to be found,
        or a command to complete. This method only needs to be called one time
        per session. To set the timeout for calls to execute_async_script, see
        set_script_timeout.
 
        :Args:
         - time_to_wait: Amount of time to wait (in seconds)
 
        :Usage:
            ::
 
                driver.implicitly_wait(30)
        ÚimplicitéèN©r•rÚ SET_TIMEOUTSÚintÚfloat©r{rÒr-r-r.Úimplicitly_waitÚszWebDriver.implicitly_waitcCs"| tjdtt|ƒdƒi¡dS)a!Set the amount of time that the script should wait during an
        execute_async_script call before throwing an error.
 
        :Args:
         - time_to_wait: The amount of time to wait (in seconds)
 
        :Usage:
            ::
 
                driver.set_script_timeout(30)
        r¬rÔNrÕrÙr-r-r.Úset_script_timeoutês zWebDriver.set_script_timeoutc    CsXz"| tjdtt|ƒdƒi¡Wn0tk
rR| tjt|ƒdddœ¡YnXdS)zûSet the amount of time to wait for a page load to complete before
        throwing an error.
 
        :Args:
         - time_to_wait: The amount of time to wait
 
        :Usage:
            ::
 
                driver.set_page_load_timeout(30)
        ÚpageLoadrÔz    page load)ÚmsrN)r•rrÖr×rØrrÙr-r-r.Úset_page_load_timeoutøs "zWebDriver.set_page_load_timeoutcCsP| tj¡d}| d¡d|d<| d¡d|d<| d¡d|d<tf|ŽS)z Get all the timeouts that have been set on the current session.
 
        :Usage:
            ::
                driver.timeouts
        :rtype: Timeout
        r“rÓrÔZ implicit_waitrÜZ    page_loadr¬)r•rZ GET_TIMEOUTSr¯r)r{r)r-r-r.r)    s
    zWebDriver.timeoutscCs| tj| ¡¡d}dS)aSet all timeouts for the session. This will override any previously
        set timeouts.
 
        :Usage:
            ::
                my_timeouts = Timeouts()
                my_timeouts.implicit_wait = 10
                driver.timeouts = my_timeouts
        r“N)r•rrÖZ_to_json)r{r)Ú_r-r-r.r)s )r“rXcCs¢t|tƒr4|j||d}|s,td|j›ƒ‚|dS|tjkrRtj}d|›d}n8|tjkrntj}d|›}n|tj    krŠtj}d|›d}| 
t j ||dœ¡d    S)
z²Find an element given a By strategy and locator.
 
        :Usage:
            ::
 
                element = driver.find_element(By.ID, 'foo')
 
        :rtype: WebElement
        )Úbyr“z%Cannot locate relative element with: rú[id="ú"]r€ú[name="©Zusingr“r“) rlrÚ find_elementsrÚrootrÚIDÚ CSS_SELECTORÚ
CLASS_NAMEÚNAMEr•rZ FIND_ELEMENT)r{ràr“Úelementsr-r-r.Ú find_element%s
 
 
 
 
 zWebDriver.find_elementcCsÂt|tƒrPd t d¡dd…¡}t |d¡ d¡}d|›d}| ||     ¡¡S|t
j krnt
j }d|›d    }n8|t
j krŠt
j }d|›}n|t
jkr¦t
j }d
|›d    }| tj||d œ¡d pÀgS) zÂFind elements given a By strategy and locator.
 
        :Usage:
            ::
 
                elements = driver.find_elements(By.CLASS_NAME, 'foo')
 
        :rtype: list of WebElement
        r€NéÿÿÿÿzfindElements.jsÚutf8z/* findElements */return (z).apply(null, arguments);rárârãrär“)rlrÚjoinreÚsplitÚpkgutilÚget_dataÚdecoderµrÀrrçrèrérêr•rZ FIND_ELEMENTS)r{ràr“Z_pkgZ raw_functionZfind_element_jsr-r-r.råAs
 
 
 
 
 zWebDriver.find_elementscCstjdtdd|jS)z<returns the drivers current desired capabilities being used.z=desired_capabilities is deprecated. Please call capabilities.r1r2)r?r@rArCr‚r-r-r.r|_szWebDriver.desired_capabilitiescCs|jS)z4returns the drivers current capabilities being used.)rCr‚r-r-r.rMeszWebDriver.capabilitiesc    Cstt|ƒ ¡ d¡st dt¡| ¡}zDz$t|dƒ}| |¡W5QRXWnt    k
rfYW¢
dSXW5~XdS)a¤Saves a screenshot of the current window to a PNG image file.
        Returns False if there is any IOError, else returns True. Use full
        paths in your filename.
 
        :Args:
         - filename: The full path you wish to save your screenshot to. This
           should end with a `.png` extension.
 
        :Usage:
            ::
 
                driver.get_screenshot_as_file('/Screenshots/foo.png')
        z.pngz^name used for saved screenshot does not match file type. It should end with a `.png` extensionÚwbFT)
rpr<Úendswithr?r@Ú UserWarningÚget_screenshot_as_pngÚopenÚwriteÚOSError)r{ÚfilenameZpngÚfr-r-r.Úget_screenshot_as_filejsþ z WebDriver.get_screenshot_as_filecCs
| |¡S)aSaves a screenshot of the current window to a PNG image file.
        Returns False if there is any IOError, else returns True. Use full
        paths in your filename.
 
        :Args:
         - filename: The full path you wish to save your screenshot to. This
           should end with a `.png` extension.
 
        :Usage:
            ::
 
                driver.save_screenshot('/Screenshots/foo.png')
        )rý)r{rûr-r-r.Úsave_screenshot‡szWebDriver.save_screenshotcCst| ¡ d¡ƒS)z”Gets the screenshot of the current window as a binary data.
 
        :Usage:
            ::
 
                driver.get_screenshot_as_png()
        Úascii)rÚget_screenshot_as_base64Úencoder‚r-r-r.r÷—szWebDriver.get_screenshot_as_pngcCs| tj¡dS)zÔGets the screenshot of the current window as a base64 encoded string
        which is useful in embedded images in HTML.
 
        :Usage:
            ::
 
                driver.get_screenshot_as_base64()
        r“)r•rZ
SCREENSHOTr‚r-r-r.r¡s    z"WebDriver.get_screenshot_as_base64Úcurrent)Ú windowHandlerXcCs,|dkrt d¡|jt|ƒt|ƒddS)a$Sets the width and height of the current window. (window.resizeTo)
 
        :Args:
         - width: the width in pixels to set the window to
         - height: the height in pixels to set the window to
 
        :Usage:
            ::
 
                driver.set_window_size(800,600)
        rú?Only 'current' window is supported for W3C compatible browsers.©ÚwidthÚheightN©r?r@Úset_window_rectr×)r{rrrr-r-r.Úset_window_size¬s 
zWebDriver.set_window_sizecs@|dkrt d¡| ¡‰ˆ dd¡r.ˆd‰‡fdd„dDƒS)zƒGets the width and height of the current window.
 
        :Usage:
            ::
 
                driver.get_window_size()
        rrr“Ncsi|]}|ˆ|“qSr-r-©rJrD©Úsizer-r.Ú
<dictcomp>Ìsz-WebDriver.get_window_size.<locals>.<dictcomp>r)r?r@Úget_window_rectr;©r{rr-r r.Úget_window_size¼s     
 zWebDriver.get_window_sizecCs(|dkrt d¡|jt|ƒt|ƒdS)a.Sets the x,y position of the current window. (window.moveTo)
 
        :Args:
         - x: the x-coordinate in pixels to set the window position
         - y: the y-coordinate in pixels to set the window position
 
        :Usage:
            ::
 
                driver.set_window_position(0,0)
        rr©ÚxÚyr)r{rrrr-r-r.Úset_window_positionÎs 
zWebDriver.set_window_positioncs,|dkrt d¡| ¡‰‡fdd„dDƒS)zƒGets the x,y position of the current window.
 
        :Usage:
            ::
 
                driver.get_window_position()
        rrcsi|]}|ˆ|“qSr-r-r ©Úpositionr-r.rësz1WebDriver.get_window_position.<locals>.<dictcomp>r)r?r@rrr-rr.Úget_window_positionÞs    
zWebDriver.get_window_positioncCs| tj¡dS)zµGets the x, y coordinates of the window as well as height and width
        of the current window.
 
        :Usage:
            ::
 
                driver.get_window_rect()
        r“)r•rZGET_WINDOW_RECTr‚r-r-r.rís    zWebDriver.get_window_rectcCs<|dkr |dkr |s |s tdƒ‚| tj||||dœ¡dS)aÙSets the x, y coordinates of the window as well as height and width
        of the current window. This method is only supported for W3C compatible
        browsers; other browsers should use `set_window_position` and
        `set_window_size`.
 
        :Usage:
            ::
 
                driver.set_window_rect(x=10, y=10)
                driver.set_window_rect(width=100, height=200)
                driver.set_window_rect(x=10, y=10, width=100, height=200)
        Nz'x and y or height and width need values)rrrrr“)r r•rZSET_WINDOW_RECT)r{rrrrr-r-r.r    øszWebDriver.set_window_rectcCs|jSr„)Ú_file_detectorr‚r-r-r.rw szWebDriver.file_detectorcCs(|s tdƒ‚t|tƒstdƒ‚||_dS)a0Set the file detector to be used when sending keyboard input. By
        default, this is set to a file detector that does nothing.
 
        see FileDetector
        see LocalFileDetector
        see UselessFileDetector
 
        :Args:
         - detector: The detector to use. Must not be None.
        z,You may not set a file detector that is nullz+Detector has to be instance of FileDetectorN)rrlrr)r{Údetectorr-r-r.rws
 
cCs| tj¡dS)z†Gets the current orientation of the device.
 
        :Usage:
            ::
 
                orientation = driver.orientation
        r“)r•rZGET_SCREEN_ORIENTATIONr‚r-r-r.Ú orientation!s    zWebDriver.orientationcCs4ddg}| ¡|kr(| tjd|i¡ntdƒ‚dS)zÂSets the current orientation of the device.
 
        :Args:
         - value: orientation to set it to.
 
        :Usage:
            ::
 
                driver.orientation = 'landscape'
        Z    LANDSCAPEZPORTRAITrz>You can only set the orientation to 'LANDSCAPE' and 'PORTRAIT'N)Úupperr•rZSET_SCREEN_ORIENTATIONr)r{r“Zallowed_valuesr-r-r.r,s  cCst|ƒS)zQReturns a ApplicationCache Object to interact with the browser app
        cache.rr‚r-r-r.Úapplication_cache>szWebDriver.application_cachecCs| tj¡dS)z§Gets a list of the available log types. This only works with w3c
        compliant browsers.
 
        :Usage:
            ::
 
                driver.log_types
        r“)r•rZGET_AVAILABLE_LOG_TYPESr‚r-r-r.Ú    log_typesDs
zWebDriver.log_typescCs| tjd|i¡dS)a>Gets the log for a given log type.
 
        :Args:
         - log_type: type of log that which will be returned
 
        :Usage:
            ::
 
                driver.get_log('browser')
                driver.get_log('driver')
                driver.get_log('client')
                driver.get_log('server')
        rr“)r•rZGET_LOG)r{Zlog_typer-r-r.Úget_logPszWebDriver.get_logc CsÒtƒ|j d¡r6|j d¡}|j d¡ d¡d}n | ¡\}}|sNtdƒ‚t |¡}t |¡4IdHšX}|     |j
  ¡¡IdH}|dj }|  |¡4IdHš}t|t|ƒVW5QIdHRXW5QIdHRXdS)Nzse:cdpz se:cdpVersionr€rz2Unable to find url to connect to from capabilities)r/rCr;rðÚ_get_cdp_detailsrr,Zimport_devtoolsZopen_cdpr•ÚtargetZ get_targetsÚ    target_idZ open_sessionr)r{Zws_urlr*ZdevtoolsÚconnÚtargetsr"Úsessionr-r-r.Úbidi_connection`s   
 
zWebDriver.bidi_connectionc CsÆddl}ddl}| ¡}d}|j d¡dkrV|j |j›d|j d¡›d¡ d¡}nd}|j d    ¡}| d
d |›d ¡}| |j¡}| d ¡}| d¡}    ddl    }
|r¬d} n|
 
d|¡  d¡} | |    fS)NrFr'Zchromer4ÚOptionsZdebuggerAddressTzmoz:debuggerAddressr©zhttp://z /json/versionZBrowserZwebSocketDebuggerUrléUz
.*/(\d+)\.r) ÚjsonÚurllib3Ú PoolManagerrCr;Z vendor_prefixÚrequestÚloadsÚdataÚreÚsearchÚgroup) r{r)r*ÚhttpZ_firefoxZdebugger_addressÚresr.Zbrowser_versionZ websocket_urlr/r*r-r-r.r ts&"ÿ  
 
zWebDriver._get_cdp_detailscCs| tj| ¡¡d|_dS)z4Adds a virtual authenticator with the given options.r“N)r•rZADD_VIRTUAL_AUTHENTICATORrÀrx)r{rWr-r-r.Úadd_virtual_authenticator”sz#WebDriver.add_virtual_authenticatorcCs|jS)z,Returns the id of the virtual authenticator.)rxr‚r-r-r.Úvirtual_authenticator_id˜sz"WebDriver.virtual_authenticator_idcCs| tjd|ji¡d|_dS)zœRemoves a previously added virtual authenticator.
 
        The authenticator is no longer valid after removal, so no
        methods may be called.
        ÚauthenticatorIdN)r•rZREMOVE_VIRTUAL_AUTHENTICATORrxr‚r-r-r.Úremove_virtual_authenticatorsz&WebDriver.remove_virtual_authenticator)Ú
credentialrXcCs | tj| ¡d|ji–¡dS)z,Injects a credential into the authenticator.r6N)r•rZADD_CREDENTIALrÀrx)r{r8r-r-r.Úadd_credential§szWebDriver.add_credentialcCs&| tjd|ji¡}dd„|dDƒS)z;Returns the list of credentials owned by the authenticator.r6cSsg|]}t |¡‘qSr-)rÚ    from_dict)rJr8r-r-r.Ú
<listcomp>°sz-WebDriver.get_credentials.<locals>.<listcomp>r“)r•rZGET_CREDENTIALSrx)r{Zcredential_datar-r-r.Úget_credentials¬szWebDriver.get_credentials)Ú credential_idrXcCs0t|tƒrt|ƒ ¡}| tj||jdœ¡dS)z,Removes a credential from the authenticator.)Z credentialIdr6N)rlÚ    bytearrayrrór•rZREMOVE_CREDENTIALrx)r{r=r-r-r.Úremove_credential²s 
 
ÿzWebDriver.remove_credentialcCs| tjd|ji¡dS)z/Removes all credentials from the authenticator.r6N)r•rZREMOVE_ALL_CREDENTIALSrxr‚r-r-r.Úremove_all_credentials½sz WebDriver.remove_all_credentials)ÚverifiedrXcCs| tj|j|dœ¡dS)z¾Sets whether the authenticator will simulate success or fail on user
        verification.
 
        verified: True if the authenticator will pass user verification, False otherwise.
        )r6ZisUserVerifiedN)r•rZSET_USER_VERIFIEDrx)r{rAr-r-r.Úset_user_verifiedÂszWebDriver.set_user_verified)rkNNNTNN)N)N)N)N)r)r)r)r)NNNN)prerfrgrhr&rr$rŸr rr    r~rƒr…Útypingr
ÚTypeÚ BaseExceptionÚtypesÚ TracebackTyperŠrrÚpropertyr!rŽrprryr‘rorzršr£r¤r•r;r«r#r®r°r±rµr¶r·r¸r¹r‰rºr»r¼r½r¾rrÁr%rÂrÃrÄrÅrÆrrÊrËrÌrÑrØrÚrÛrÞrr)Úsetterrrçrìrår|rMÚboolrýrþrqr÷rr
rrrrr    rrwrrrrrr&r rr4r5rr7rr9r<r>r?r@rBr-r-r-r.rjºsî ø÷ V
ü 
 
 
 
 
 
 
 
 
 
 
  
 
 
 
 
 
     
rj)F)IrhrÇr9rñrFrCr?ÚabcrÚbase64rrrrÚ    importlibrrr    r
r Zselenium.common.exceptionsr r rrrZselenium.webdriver.common.byrZ1selenium.webdriver.common.html5.application_cacherZ!selenium.webdriver.common.optionsrZ,selenium.webdriver.common.print_page_optionsrZ"selenium.webdriver.common.timeoutsrZ/selenium.webdriver.common.virtual_authenticatorrrrZ+selenium.webdriver.support.relative_locatorrr&rr´rZ errorhandlerrrwrr rŽr!Zremote_connectionr"r­r#Z
shadowrootr$rÂr%Z
webelementr&Ú    frozensetrBr>r,r/rFrUrcrdrjr-r-r-r.Ú<module>s~                                   õÿ )
"