setup-selenium-testing 1.0.2__py3-none-any.whl → 1.0.5__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.
@@ -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:
@@ -432,24 +435,25 @@ 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 = "3G"):
436
439
  """Experimental settings to slow down browser"""
437
440
  # experimental settings to slow down browser
438
441
  # @formatter:off
439
442
  # fmt: off
440
443
  network_conditions = {
441
- # latency, down, up
444
+ # latency, down, up
442
445
  "GPRS" : (500, 50, 20),
446
+ "2G" : (300, 250, 50),
443
447
  "SLOW3G" : (100, 250, 100),
444
- "FAST3G" : (40, 750, 250),
448
+ "3G" : (100, 750, 250),
449
+ "FAST3G" : (40, 1500, 750),
445
450
  "LTE" : (20, 4000, 3000),
446
451
  "DSL" : (5, 2000, 1000),
447
452
  "WIFI" : (2, 30000, 15000),
448
453
  }
449
454
  # fmt: on
450
455
  # @formatter:on
451
- net_type = "SLOW3G"
452
- net_lat, net_down, net_up = network_conditions[net_type]
456
+ net_lat, net_down, net_up = network_conditions[network_type]
453
457
  net_down = net_down / 8 * 1024
454
458
  net_up = net_up / 8 * 1024
455
459
  driver.set_network_conditions(
@@ -458,7 +462,11 @@ class SetupSelenium:
458
462
  download_throughput=net_down,
459
463
  upload_throughput=net_up,
460
464
  )
461
- driver.execute_cdp_cmd("Emulation.setCPUThrottlingRate", {"rate": 100})
465
+
466
+ @staticmethod
467
+ def set_cpu_throttle(driver: webdriver.Chrome, rate: int = 10):
468
+ """Experimental settings to slow down browser"""
469
+ driver.execute_cdp_cmd("Emulation.setCPUThrottlingRate", {"rate": rate})
462
470
 
463
471
  @staticmethod
464
472
  def edge_options() -> webdriver.EdgeOptions:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: setup-selenium-testing
3
- Version: 1.0.2
3
+ Version: 1.0.5
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.5
149
+
150
+ - updated throttling functions
151
+
148
152
  ### version 1.0.2
149
153
 
150
154
  - removed python 3.8 support
@@ -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=v_Da_pcC0kJKWLazKFEWgg7iJeTHUwT7AOOWBrLt1pc,22232
4
+ setup_selenium_testing-1.0.5.dist-info/LICENSE,sha256=KGdE-1D1chm3UNFtfE8x-EpVxhmv2zFx8oltbO8M1qE,1070
5
+ setup_selenium_testing-1.0.5.dist-info/METADATA,sha256=wUzQsQuknCf_Z4TugObKSFcOD7ARitQTDNyApBivGVc,6122
6
+ setup_selenium_testing-1.0.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
+ setup_selenium_testing-1.0.5.dist-info/RECORD,,
@@ -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=qqnq-jErsovCJW2qMyx2mtNUqVl-h_VQXGh8Vzh4uJM,21857
4
- setup_selenium_testing-1.0.2.dist-info/LICENSE,sha256=KGdE-1D1chm3UNFtfE8x-EpVxhmv2zFx8oltbO8M1qE,1070
5
- setup_selenium_testing-1.0.2.dist-info/METADATA,sha256=iIGM3X1I_PlyFcXL7lHpRlYzcNPeIsdTD4YgpXKRFf0,6071
6
- setup_selenium_testing-1.0.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
- setup_selenium_testing-1.0.2.dist-info/RECORD,,