setup-selenium-testing 0.1.8__tar.gz → 0.3.0__tar.gz

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.
@@ -1,18 +1,16 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: setup-selenium-testing
3
- Version: 0.1.8
3
+ Version: 0.3.0
4
4
  Summary: Setup Selenium for automation testing
5
- Home-page: https://github.com/bandophahita/setup_selenium
6
5
  License: MIT
7
6
  Author: Marcel Wilson
8
- Author-email: trenchrats@gmail.com
9
- Requires-Python: >=3.8,<4.0
7
+ Author-email: trenchrats+pypi@gmail.com
8
+ Requires-Python: >=3.9,<4.0
10
9
  Classifier: Intended Audience :: Developers
11
10
  Classifier: License :: OSI Approved :: MIT License
12
11
  Classifier: Natural Language :: English
13
12
  Classifier: Operating System :: OS Independent
14
13
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.8
16
14
  Classifier: Programming Language :: Python :: 3.9
17
15
  Classifier: Programming Language :: Python :: 3.10
18
16
  Classifier: Programming Language :: Python :: 3.11
@@ -1,8 +1,8 @@
1
1
  [tool.poetry]
2
2
  name = "setup-selenium-testing"
3
- version = "0.1.8"
3
+ version = "0.3.0"
4
4
  description = "Setup Selenium for automation testing"
5
- authors = ["Marcel Wilson <trenchrats@gmail.com>"]
5
+ authors = ["Marcel Wilson <trenchrats+pypi@gmail.com>"]
6
6
  license = "MIT"
7
7
  repository = "https://github.com/bandophahita/setup_selenium"
8
8
  #documentation = ""
@@ -10,7 +10,6 @@ readme = "README.md"
10
10
  classifiers = [
11
11
  "Operating System :: OS Independent",
12
12
  "Programming Language :: Python :: 3 :: Only",
13
- "Programming Language :: Python :: 3.8",
14
13
  "Programming Language :: Python :: 3.9",
15
14
  "Programming Language :: Python :: 3.10",
16
15
  "Programming Language :: Python :: 3.11",
@@ -23,7 +22,7 @@ packages = [{include = "setup_selenium"}]
23
22
 
24
23
 
25
24
  [tool.poetry.dependencies]
26
- python = "^3.8"
25
+ python = "^3.9"
27
26
  selenium = ">=4.7.0"
28
27
  semantic-version = "*"
29
28
  typing-extensions = "*"
@@ -67,7 +66,7 @@ build-backend = "poetry.core.masonry.api"
67
66
 
68
67
 
69
68
  [tool.ruff]
70
- target-version = "py38"
69
+ target-version = "py39"
71
70
  line-length = 88
72
71
  extend-exclude = [
73
72
  ".github",
@@ -160,6 +160,7 @@ class SetupSelenium:
160
160
  @staticmethod
161
161
  def log_options(options: ArgOptions) -> None:
162
162
  """Logs the browser option in clean format"""
163
+ # logger.debug(f"{json.dumps(options.capabilities, indent=2)}") # noqa: ERA001
163
164
  opts = "\n".join(options.arguments)
164
165
  logger.debug(f"{opts}")
165
166
 
@@ -282,6 +283,24 @@ class SetupSelenium:
282
283
  options.set_preference(
283
284
  "extensions.formautofill.addresses.capture.enabled", False
284
285
  )
286
+ # By default, headless Firefox runs as though no pointers capabilities
287
+ # are available.
288
+ # https://github.com/microsoft/playwright/issues/7769#issuecomment-966098074
289
+ #
290
+ # This impacts React Spectrum which uses an '(any-pointer: fine)'
291
+ # media query to determine font size. It also causes certain chart
292
+ # elements to always be visible that should only be visible on
293
+ # hover.
294
+ #
295
+ # Available values for pointer capabilities:
296
+ # NO_POINTER 0x00
297
+ # COARSE_POINTER 0x01
298
+ # FINE_POINTER 0x02
299
+ # HOVER_CAPABLE_POINTER 0x04
300
+ #
301
+ # Setting to 0x02 | 0x04 says the system supports a mouse
302
+ options.set_preference("ui.primaryPointerCapabilities", 0x02 | 0x04)
303
+ options.set_preference("ui.allPointerCapabilities", 0x02 | 0x04)
285
304
  return options
286
305
 
287
306
  @staticmethod
@@ -338,9 +357,29 @@ class SetupSelenium:
338
357
  def chrome_options() -> webdriver.ChromeOptions:
339
358
  """Default options for chrome"""
340
359
  logger.debug("Setting up chrome options")
360
+ # the ultimate list of flags (created by the chromium dev group)
361
+ # https://peter.sh/experiments/chromium-command-line-switches/
362
+
341
363
  # The list of options set below mostly came from this StackOverflow post
342
364
  # https://stackoverflow.com/q/48450594/2532408
343
365
  opts = (
366
+ # "--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync", # noqa: ERA001
367
+ "--disable-back-forward-cache",
368
+ "--disable-background-timer-throttling",
369
+ "--disable-breakpad",
370
+ "--disable-component-extensions-with-background-pages",
371
+ "--disable-ipc-flooding-protection",
372
+ "--enable-features=NetworkService,NetworkServiceInProcess",
373
+ "--enable-logging",
374
+ "--export-tagged-pdf",
375
+ "--force-color-profile=srgb",
376
+ "--metrics-recording-only",
377
+ "--mute-audio",
378
+ "--remote-debugging-pipe",
379
+ # fixes MUI fade issue
380
+ "--disable-renderer-backgrounding",
381
+ # fixes actionchains in headless
382
+ "--disable-backgrounding-occluded-windows",
344
383
  "--disable-extensions",
345
384
  "--allow-running-insecure-content",
346
385
  "--ignore-certificate-errors",
@@ -378,7 +417,7 @@ class SetupSelenium:
378
417
  options.binary_location = binary
379
418
 
380
419
  if headless:
381
- options.add_argument("--headless")
420
+ options.add_argument("--headless=new")
382
421
 
383
422
  logging_prefs = {"browser": "OFF", "performance": "OFF", "driver": "OFF"}
384
423
 
@@ -475,9 +514,29 @@ class SetupSelenium:
475
514
  def edge_options() -> webdriver.EdgeOptions:
476
515
  """Default options for edgedriver"""
477
516
  logger.debug("Setting up edge options")
517
+ # the ultimate list of flags (created by the chromium dev group)
518
+ # https://peter.sh/experiments/chromium-command-line-switches/
519
+
478
520
  # The list of options set below mostly came from this StackOverflow post
479
521
  # https://stackoverflow.com/q/48450594/2532408
480
522
  opts = (
523
+ # "--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync", # noqa: ERA001
524
+ "--disable-back-forward-cache",
525
+ "--disable-background-timer-throttling",
526
+ "--disable-breakpad",
527
+ "--disable-component-extensions-with-background-pages",
528
+ "--disable-ipc-flooding-protection",
529
+ "--enable-features=NetworkService,NetworkServiceInProcess",
530
+ "--enable-logging",
531
+ "--export-tagged-pdf",
532
+ "--force-color-profile=srgb",
533
+ "--metrics-recording-only",
534
+ "--mute-audio",
535
+ "--remote-debugging-pipe",
536
+ # fixes MUI fade issue
537
+ "--disable-renderer-backgrounding",
538
+ # fixes actionchains in headless
539
+ "--disable-backgrounding-occluded-windows",
481
540
  "--disable-extensions",
482
541
  "--allow-running-insecure-content",
483
542
  "--ignore-certificate-errors",
@@ -523,12 +582,11 @@ class SetupSelenium:
523
582
  # by default performance is disabled.
524
583
  if enable_log_performance:
525
584
  logging_prefs["performance"] = "ALL"
526
- options.set_capability(
585
+ options.add_experimental_option(
527
586
  "perfLoggingPrefs",
528
587
  {
529
588
  "enableNetwork": True,
530
589
  "enablePage": False,
531
- "enableTimeline": False,
532
590
  },
533
591
  )
534
592