setup-selenium-testing 1.0.1__py3-none-any.whl → 1.0.4__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.
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
  import logging
6
6
  import os as os
7
7
  from enum import Enum
8
- from typing import TYPE_CHECKING, Optional, Union
8
+ from typing import TYPE_CHECKING, Union
9
9
 
10
10
  from selenium import __version__, webdriver
11
11
  from selenium.webdriver.chrome.service import Service as ChromeService
@@ -128,6 +128,9 @@ class SetupSelenium:
128
128
 
129
129
  sm = SeleniumManager()
130
130
 
131
+ if browser == Browser.EDGE:
132
+ os.environ["SE_DRIVER_MIRROR_URL"] = "https://msedgedriver.microsoft.com"
133
+
131
134
  if NEW_SELENIUM:
132
135
  args = [f"{sm._get_binary()}", "--browser", browser]
133
136
  else:
@@ -171,7 +174,7 @@ class SetupSelenium:
171
174
  log_dir: str = "./logs",
172
175
  binary: str | None = None,
173
176
  driver_path: str | None = None,
174
- options: Optional[T_DrvOpts] = None,
177
+ options: T_DrvOpts | None = None,
175
178
  ) -> T_WebDriver:
176
179
  """Instantiates the browser driver"""
177
180
  browser = browser.lower()
@@ -325,7 +328,7 @@ class SetupSelenium:
325
328
  "--force-color-profile=srgb",
326
329
  "--metrics-recording-only",
327
330
  "--mute-audio",
328
- # "--remote-debugging-pipe",
331
+ # "--remote-debugging-pipe", # noqa: ERA001
329
332
  # fixes MUI fade issue
330
333
  "--disable-renderer-backgrounding",
331
334
  # fixes actionchains in headless
@@ -432,7 +435,7 @@ class SetupSelenium:
432
435
  return driver
433
436
 
434
437
  @staticmethod
435
- def set_throttle(driver: webdriver.Chrome):
438
+ def set_network_throttle(driver: webdriver.Chrome, network_type: str = "SLOW3G"):
436
439
  """Experimental settings to slow down browser"""
437
440
  # experimental settings to slow down browser
438
441
  # @formatter:off
@@ -448,8 +451,7 @@ class SetupSelenium:
448
451
  }
449
452
  # fmt: on
450
453
  # @formatter:on
451
- net_type = "SLOW3G"
452
- net_lat, net_down, net_up = network_conditions[net_type]
454
+ net_lat, net_down, net_up = network_conditions[network_type]
453
455
  net_down = net_down / 8 * 1024
454
456
  net_up = net_up / 8 * 1024
455
457
  driver.set_network_conditions(
@@ -458,7 +460,11 @@ class SetupSelenium:
458
460
  download_throughput=net_down,
459
461
  upload_throughput=net_up,
460
462
  )
461
- driver.execute_cdp_cmd("Emulation.setCPUThrottlingRate", {"rate": 100})
463
+
464
+ @staticmethod
465
+ def set_cpu_throttle(driver: webdriver.Chrome, rate: int = 10):
466
+ """Experimental settings to slow down browser"""
467
+ driver.execute_cdp_cmd("Emulation.setCPUThrottlingRate", {"rate": rate})
462
468
 
463
469
  @staticmethod
464
470
  def edge_options() -> webdriver.EdgeOptions:
@@ -482,7 +488,7 @@ class SetupSelenium:
482
488
  "--force-color-profile=srgb",
483
489
  "--metrics-recording-only",
484
490
  "--mute-audio",
485
- # "--remote-debugging-pipe",
491
+ # "--remote-debugging-pipe", # noqa: ERA001
486
492
  # fixes MUI fade issue
487
493
  "--disable-renderer-backgrounding",
488
494
  # fixes actionchains in headless
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: setup-selenium-testing
3
- Version: 1.0.1
3
+ Version: 1.0.4
4
4
  Summary: Setup Selenium for automation testing
5
5
  License: MIT
6
6
  Author: Marcel Wilson
@@ -145,6 +145,10 @@ Passing a valid `driver_path` will not trigger any download of the webdriver.
145
145
 
146
146
  CHANGELOG
147
147
  ---------
148
+ ### version 1.0.2
149
+
150
+ - removed python 3.8 support
151
+
148
152
  ### version 1.0.1
149
153
 
150
154
  - removed `--remote-debugging-pipe` from default chrome options (causes older chrome to crash)
@@ -0,0 +1,7 @@
1
+ setup_selenium/__init__.py,sha256=-w9Vvo72ZLaEyIEfc_Nh0bDDJz9W0pOy4rkRXurIJHI,63
2
+ setup_selenium/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ setup_selenium/setup_selenium.py,sha256=gp1RqWGXdgxVotFmq_IJVGQURrb3laOoGcVP0c4dWBc,22139
4
+ setup_selenium_testing-1.0.4.dist-info/LICENSE,sha256=KGdE-1D1chm3UNFtfE8x-EpVxhmv2zFx8oltbO8M1qE,1070
5
+ setup_selenium_testing-1.0.4.dist-info/METADATA,sha256=9ZaLVTdseyRKL-Mv0jD6gryHNcv3PFHo5-3c8j0OA2I,6071
6
+ setup_selenium_testing-1.0.4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
+ setup_selenium_testing-1.0.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.1
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,7 +0,0 @@
1
- setup_selenium/__init__.py,sha256=-w9Vvo72ZLaEyIEfc_Nh0bDDJz9W0pOy4rkRXurIJHI,63
2
- setup_selenium/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- setup_selenium/setup_selenium.py,sha256=5l07nI2ff2NxRToUbWMW4n66UujMEnMIsmmqulDirjA,21838
4
- setup_selenium_testing-1.0.1.dist-info/LICENSE,sha256=KGdE-1D1chm3UNFtfE8x-EpVxhmv2zFx8oltbO8M1qE,1070
5
- setup_selenium_testing-1.0.1.dist-info/METADATA,sha256=tQltLEyzmtpXKM9XPUR5ozcnqdTOnzx3rtwK7YNjwSM,6022
6
- setup_selenium_testing-1.0.1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
7
- setup_selenium_testing-1.0.1.dist-info/RECORD,,