setup-selenium-testing 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- setup_selenium/selenium_module.py +19 -8
- {setup_selenium_testing-0.1.2.dist-info → setup_selenium_testing-0.1.3.dist-info}/METADATA +1 -1
- setup_selenium_testing-0.1.3.dist-info/RECORD +7 -0
- setup_selenium_testing-0.1.2.dist-info/RECORD +0 -7
- {setup_selenium_testing-0.1.2.dist-info → setup_selenium_testing-0.1.3.dist-info}/LICENSE +0 -0
- {setup_selenium_testing-0.1.2.dist-info → setup_selenium_testing-0.1.3.dist-info}/WHEEL +0 -0
@@ -1,11 +1,12 @@
|
|
1
1
|
"""Setup selenium for testing"""
|
2
|
+
|
2
3
|
from __future__ import annotations
|
3
4
|
|
4
5
|
import errno
|
5
6
|
import logging
|
6
7
|
import os as os
|
7
8
|
from enum import Enum
|
8
|
-
from typing import TYPE_CHECKING, Union
|
9
|
+
from typing import TYPE_CHECKING, Optional, Union
|
9
10
|
|
10
11
|
from selenium import webdriver
|
11
12
|
from selenium.common.exceptions import NoSuchWindowException, WebDriverException
|
@@ -23,6 +24,9 @@ if TYPE_CHECKING:
|
|
23
24
|
from selenium.webdriver.common.options import ArgOptions
|
24
25
|
|
25
26
|
T_WebDriver: TypeAlias = Union[Firefox, Chrome, Edge]
|
27
|
+
T_DrvOpts: TypeAlias = Union[
|
28
|
+
webdriver.FirefoxOptions, webdriver.ChromeOptions, webdriver.EdgeOptions
|
29
|
+
]
|
26
30
|
|
27
31
|
__all__ = ["SetupSelenium"]
|
28
32
|
|
@@ -202,20 +206,24 @@ class SetupSelenium:
|
|
202
206
|
log_dir: str = "./logs",
|
203
207
|
binary: str | None = None,
|
204
208
|
driver_path: str | None = None,
|
209
|
+
options: Optional[T_DrvOpts] = None,
|
205
210
|
) -> T_WebDriver:
|
206
211
|
"""Instantiates the browser driver"""
|
207
212
|
browser = browser.lower()
|
208
213
|
driver: T_WebDriver
|
209
214
|
if browser == Browser.FIREFOX:
|
215
|
+
assert options is None or isinstance(options, webdriver.FirefoxOptions)
|
210
216
|
driver = SetupSelenium.firefox(
|
211
217
|
headless=headless,
|
212
218
|
enable_log_driver=enable_log_driver,
|
213
219
|
log_dir=log_dir,
|
214
220
|
binary=binary,
|
215
221
|
driver_path=driver_path,
|
222
|
+
options=options,
|
216
223
|
)
|
217
224
|
|
218
225
|
elif browser == Browser.CHROME:
|
226
|
+
assert options is None or isinstance(options, webdriver.ChromeOptions)
|
219
227
|
driver = SetupSelenium.chrome(
|
220
228
|
headless=headless,
|
221
229
|
enable_log_performance=enable_log_performance,
|
@@ -224,9 +232,11 @@ class SetupSelenium:
|
|
224
232
|
log_dir=log_dir,
|
225
233
|
binary=binary,
|
226
234
|
driver_path=driver_path,
|
235
|
+
options=options,
|
227
236
|
)
|
228
237
|
|
229
238
|
elif browser == Browser.EDGE:
|
239
|
+
assert options is None or isinstance(options, webdriver.EdgeOptions)
|
230
240
|
driver = SetupSelenium.edge(
|
231
241
|
headless=headless,
|
232
242
|
enable_log_performance=enable_log_performance,
|
@@ -235,6 +245,7 @@ class SetupSelenium:
|
|
235
245
|
log_dir=log_dir,
|
236
246
|
binary=binary,
|
237
247
|
driver_path=driver_path,
|
248
|
+
options=options,
|
238
249
|
)
|
239
250
|
|
240
251
|
else:
|
@@ -263,7 +274,7 @@ class SetupSelenium:
|
|
263
274
|
log_dir: str = "./logs",
|
264
275
|
driver_path: str | None = None,
|
265
276
|
binary: str | None = None,
|
266
|
-
options: webdriver.FirefoxOptions = None,
|
277
|
+
options: webdriver.FirefoxOptions | None = None,
|
267
278
|
) -> webdriver.Firefox:
|
268
279
|
"""Instantiates firefox geockodriver"""
|
269
280
|
options = options or SetupSelenium.firefox_options()
|
@@ -336,7 +347,7 @@ class SetupSelenium:
|
|
336
347
|
log_dir: str = "./logs",
|
337
348
|
driver_path: str | None = None,
|
338
349
|
binary: str | None = None,
|
339
|
-
options: webdriver.ChromeOptions = None,
|
350
|
+
options: webdriver.ChromeOptions | None = None,
|
340
351
|
) -> webdriver.Chrome:
|
341
352
|
"""Instantiates chromedriver"""
|
342
353
|
options = options or SetupSelenium.chrome_options()
|
@@ -379,12 +390,12 @@ class SetupSelenium:
|
|
379
390
|
service = ChromeService(
|
380
391
|
executable_path=driver_path,
|
381
392
|
service_args=args,
|
382
|
-
log_output=logpath,
|
393
|
+
log_output=logpath, # type: ignore[arg-type]
|
383
394
|
)
|
384
395
|
else:
|
385
396
|
service = ChromeService(
|
386
397
|
service_args=args,
|
387
|
-
log_output=logpath,
|
398
|
+
log_output=logpath, # type: ignore[arg-type]
|
388
399
|
)
|
389
400
|
|
390
401
|
driver = webdriver.Chrome(service=service, options=options)
|
@@ -469,7 +480,7 @@ class SetupSelenium:
|
|
469
480
|
log_dir: str = "./logs",
|
470
481
|
driver_path: str | None = None,
|
471
482
|
binary: str | None = None,
|
472
|
-
options: webdriver.EdgeOptions = None,
|
483
|
+
options: webdriver.EdgeOptions | None = None,
|
473
484
|
) -> webdriver.Edge:
|
474
485
|
"""Instantiates edgedriver"""
|
475
486
|
options = options or SetupSelenium.edge_options()
|
@@ -513,12 +524,12 @@ class SetupSelenium:
|
|
513
524
|
service = EdgeService(
|
514
525
|
executable_path=driver_path,
|
515
526
|
service_args=args,
|
516
|
-
log_output=logpath,
|
527
|
+
log_output=logpath, # type: ignore[arg-type]
|
517
528
|
)
|
518
529
|
else:
|
519
530
|
service = EdgeService(
|
520
531
|
service_args=args,
|
521
|
-
log_output=logpath,
|
532
|
+
log_output=logpath, # type: ignore[arg-type]
|
522
533
|
)
|
523
534
|
driver = webdriver.Edge(service=service, options=options)
|
524
535
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
setup_selenium/__init__.py,sha256=Wem42Sg7sr4nq1d_qVeSrxee5YXllJvfex3sBdoiCRM,64
|
2
|
+
setup_selenium/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
setup_selenium/selenium_module.py,sha256=4nLGWMXQsUwQPxJWMuq8XnR_qNHQGhyF7ta71SomzrQ,21006
|
4
|
+
setup_selenium_testing-0.1.3.dist-info/LICENSE,sha256=KGdE-1D1chm3UNFtfE8x-EpVxhmv2zFx8oltbO8M1qE,1070
|
5
|
+
setup_selenium_testing-0.1.3.dist-info/METADATA,sha256=CsHV_im2TaGQtkc2Oe85GAdpusQ6PIiTcEfA53IM_ZI,5385
|
6
|
+
setup_selenium_testing-0.1.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
7
|
+
setup_selenium_testing-0.1.3.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
setup_selenium/__init__.py,sha256=Wem42Sg7sr4nq1d_qVeSrxee5YXllJvfex3sBdoiCRM,64
|
2
|
-
setup_selenium/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
setup_selenium/selenium_module.py,sha256=stjEILdJvX2vGonlQwi10IMTFjgICXzB53USA_DqKm0,20357
|
4
|
-
setup_selenium_testing-0.1.2.dist-info/LICENSE,sha256=KGdE-1D1chm3UNFtfE8x-EpVxhmv2zFx8oltbO8M1qE,1070
|
5
|
-
setup_selenium_testing-0.1.2.dist-info/METADATA,sha256=RYAVkq9geOH0FGv6kCYh0Z1VHZfhcxttYO36fZAeA6A,5385
|
6
|
-
setup_selenium_testing-0.1.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
7
|
-
setup_selenium_testing-0.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|