seleniumbase 4.28.1__py3-none-any.whl → 4.28.2__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.
@@ -1,2 +1,2 @@
1
1
  # seleniumbase package
2
- __version__ = "4.28.1"
2
+ __version__ = "4.28.2"
@@ -389,7 +389,9 @@ def uc_special_open_if_cf(
389
389
  driver.execute_script('window.open("%s","_blank");' % url)
390
390
  driver.close()
391
391
  if mobile_emulator:
392
- driver.switch_to.window(driver.window_handles[-1])
392
+ page_actions.switch_to_window(
393
+ driver, driver.window_handles[-1], 2
394
+ )
393
395
  uc_metrics = {}
394
396
  if (
395
397
  isinstance(device_width, int)
@@ -419,7 +421,9 @@ def uc_special_open_if_cf(
419
421
  except Exception:
420
422
  pass
421
423
  if not mobile_emulator:
422
- driver.switch_to.window(driver.window_handles[-1])
424
+ page_actions.switch_to_window(
425
+ driver, driver.window_handles[-1], 2
426
+ )
423
427
  else:
424
428
  driver.default_get(url) # The original one
425
429
  else:
@@ -450,7 +454,7 @@ def uc_open_with_tab(driver, url):
450
454
  with driver:
451
455
  driver.execute_script('window.open("%s","_blank");' % url)
452
456
  driver.close()
453
- driver.switch_to.window(driver.window_handles[-1])
457
+ page_actions.switch_to_window(driver, driver.window_handles[-1], 2)
454
458
  else:
455
459
  driver.default_get(url) # The original one
456
460
  return None
@@ -476,10 +480,14 @@ def uc_open_with_reconnect(driver, url, reconnect_time=None):
476
480
  driver.reconnect(reconnect_time)
477
481
  time.sleep(0.004)
478
482
  try:
479
- driver.switch_to.window(driver.window_handles[-1])
483
+ page_actions.switch_to_window(
484
+ driver, driver.window_handles[-1], 2
485
+ )
480
486
  except InvalidSessionIdException:
481
487
  time.sleep(0.05)
482
- driver.switch_to.window(driver.window_handles[-1])
488
+ page_actions.switch_to_window(
489
+ driver, driver.window_handles[-1], 2
490
+ )
483
491
  else:
484
492
  driver.default_get(url) # The original one
485
493
  return None
@@ -546,17 +554,17 @@ def uc_click(
546
554
  driver.reconnect(reconnect_time)
547
555
 
548
556
 
549
- def verify_pyautogui_has_a_headed_browser():
557
+ def verify_pyautogui_has_a_headed_browser(driver):
550
558
  """PyAutoGUI requires a headed browser so that it can
551
559
  focus on the correct element when performing actions."""
552
- if sb_config.headless or sb_config.headless2:
560
+ if hasattr(driver, "_is_hidden") and driver._is_hidden:
553
561
  raise Exception(
554
562
  "PyAutoGUI can't be used in headless mode!"
555
563
  )
556
564
 
557
565
 
558
- def install_pyautogui_if_missing():
559
- verify_pyautogui_has_a_headed_browser()
566
+ def install_pyautogui_if_missing(driver):
567
+ verify_pyautogui_has_a_headed_browser(driver)
560
568
  pip_find_lock = fasteners.InterProcessLock(
561
569
  constants.PipInstall.FINDLOCK
562
570
  )
@@ -608,7 +616,7 @@ def get_configured_pyautogui(pyautogui_copy):
608
616
 
609
617
 
610
618
  def uc_gui_press_key(driver, key):
611
- install_pyautogui_if_missing()
619
+ install_pyautogui_if_missing(driver)
612
620
  import pyautogui
613
621
  pyautogui = get_configured_pyautogui(pyautogui)
614
622
  gui_lock = fasteners.InterProcessLock(
@@ -619,7 +627,7 @@ def uc_gui_press_key(driver, key):
619
627
 
620
628
 
621
629
  def uc_gui_press_keys(driver, keys):
622
- install_pyautogui_if_missing()
630
+ install_pyautogui_if_missing(driver)
623
631
  import pyautogui
624
632
  pyautogui = get_configured_pyautogui(pyautogui)
625
633
  gui_lock = fasteners.InterProcessLock(
@@ -631,7 +639,7 @@ def uc_gui_press_keys(driver, keys):
631
639
 
632
640
 
633
641
  def uc_gui_write(driver, text):
634
- install_pyautogui_if_missing()
642
+ install_pyautogui_if_missing(driver)
635
643
  import pyautogui
636
644
  pyautogui = get_configured_pyautogui(pyautogui)
637
645
  gui_lock = fasteners.InterProcessLock(
@@ -648,7 +656,7 @@ def uc_gui_handle_cf(driver, frame="iframe"):
648
656
  and 'aria-label="Cloudflare"' not in source
649
657
  ):
650
658
  return
651
- install_pyautogui_if_missing()
659
+ install_pyautogui_if_missing(driver)
652
660
  import pyautogui
653
661
  pyautogui = get_configured_pyautogui(pyautogui)
654
662
  gui_lock = fasteners.InterProcessLock(
@@ -664,9 +672,7 @@ def uc_gui_handle_cf(driver, frame="iframe"):
664
672
  if not is_in_frame:
665
673
  # Make sure the window is on top
666
674
  page_actions.switch_to_window(
667
- driver,
668
- driver.current_window_handle,
669
- timeout=settings.SMALL_TIMEOUT,
675
+ driver, driver.current_window_handle, 2
670
676
  )
671
677
  if not is_in_frame or needs_switch:
672
678
  # Currently not in frame (or nested frame outside CF one)
@@ -1634,10 +1640,6 @@ def get_driver(
1634
1640
  if headless2 and browser_name == constants.Browser.FIREFOX:
1635
1641
  headless2 = False # Only for Chromium
1636
1642
  headless = True
1637
- if not hasattr(sb_config, "headless"):
1638
- sb_config.headless = headless
1639
- if not hasattr(sb_config, "headless2"):
1640
- sb_config.headless2 = headless2
1641
1643
  if (
1642
1644
  binary_location
1643
1645
  and isinstance(binary_location, str)
@@ -4035,6 +4037,8 @@ def get_local_driver(
4035
4037
  driver, *args, **kwargs
4036
4038
  )
4037
4039
  )
4040
+ driver._is_hidden = (headless or headless2)
4041
+ driver._is_using_uc = True
4038
4042
  if mobile_emulator:
4039
4043
  uc_metrics = {}
4040
4044
  if (
@@ -18,6 +18,7 @@ By.TAG_NAME # "tag name"
18
18
  By.PARTIAL_LINK_TEXT # "partial link text"
19
19
  """
20
20
  import codecs
21
+ import fasteners
21
22
  import os
22
23
  import time
23
24
  from selenium.common.exceptions import ElementNotInteractableException
@@ -32,6 +33,7 @@ from selenium.webdriver.common.keys import Keys
32
33
  from seleniumbase.common.exceptions import LinkTextNotFoundException
33
34
  from seleniumbase.common.exceptions import TextNotVisibleException
34
35
  from seleniumbase.config import settings
36
+ from seleniumbase.fixtures import constants
35
37
  from seleniumbase.fixtures import page_utils
36
38
  from seleniumbase.fixtures import shared_utils
37
39
 
@@ -1428,6 +1430,18 @@ def switch_to_frame(driver, frame, timeout=settings.SMALL_TIMEOUT):
1428
1430
  timeout_exception(Exception, message)
1429
1431
 
1430
1432
 
1433
+ def __switch_to_window(driver, window_handle):
1434
+ if hasattr(driver, "_is_using_uc") and driver._is_using_uc:
1435
+ gui_lock = fasteners.InterProcessLock(
1436
+ constants.MultiBrowser.PYAUTOGUILOCK
1437
+ )
1438
+ with gui_lock:
1439
+ driver.switch_to.window(window_handle)
1440
+ else:
1441
+ driver.switch_to.window(window_handle)
1442
+ return True
1443
+
1444
+
1431
1445
  def switch_to_window(driver, window, timeout=settings.SMALL_TIMEOUT):
1432
1446
  """
1433
1447
  Wait for a window to appear, and switch to it. This should be usable
@@ -1451,7 +1465,7 @@ def switch_to_window(driver, window, timeout=settings.SMALL_TIMEOUT):
1451
1465
  shared_utils.check_if_time_limit_exceeded()
1452
1466
  try:
1453
1467
  window_handle = driver.window_handles[window]
1454
- driver.switch_to.window(window_handle)
1468
+ __switch_to_window(driver, window_handle)
1455
1469
  return True
1456
1470
  except IndexError:
1457
1471
  now_ms = time.time() * 1000.0
@@ -1472,7 +1486,7 @@ def switch_to_window(driver, window, timeout=settings.SMALL_TIMEOUT):
1472
1486
  for x in range(int(timeout * 10)):
1473
1487
  shared_utils.check_if_time_limit_exceeded()
1474
1488
  try:
1475
- driver.switch_to.window(window_handle)
1489
+ __switch_to_window(driver, window_handle)
1476
1490
  return True
1477
1491
  except NoSuchWindowException:
1478
1492
  now_ms = time.time() * 1000.0
@@ -278,15 +278,19 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
278
278
  options.binary_location, *options.arguments
279
279
  )
280
280
  else:
281
- browser = subprocess.Popen(
282
- [options.binary_location, *options.arguments],
283
- stdin=subprocess.PIPE,
284
- stdout=subprocess.PIPE,
285
- stderr=subprocess.PIPE,
286
- close_fds=IS_POSIX,
287
- creationflags=creationflags,
281
+ gui_lock = fasteners.InterProcessLock(
282
+ constants.MultiBrowser.PYAUTOGUILOCK
288
283
  )
289
- self.browser_pid = browser.pid
284
+ with gui_lock:
285
+ browser = subprocess.Popen(
286
+ [options.binary_location, *options.arguments],
287
+ stdin=subprocess.PIPE,
288
+ stdout=subprocess.PIPE,
289
+ stderr=subprocess.PIPE,
290
+ close_fds=IS_POSIX,
291
+ creationflags=creationflags,
292
+ )
293
+ self.browser_pid = browser.pid
290
294
  service_ = None
291
295
  log_output = subprocess.PIPE
292
296
  if sys.version_info < (3, 8):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: seleniumbase
3
- Version: 4.28.1
3
+ Version: 4.28.2
4
4
  Summary: A complete web automation framework for end-to-end testing.
5
5
  Home-page: https://github.com/seleniumbase/SeleniumBase
6
6
  Author: Michael Mintz
@@ -87,7 +87,7 @@ Requires-Dist: sbvirtualdisplay ==1.3.0
87
87
  Requires-Dist: behave ==1.2.6
88
88
  Requires-Dist: beautifulsoup4 ==4.12.3
89
89
  Requires-Dist: tabcompleter ==1.3.0
90
- Requires-Dist: pdbp ==1.5.0
90
+ Requires-Dist: pdbp ==1.5.1
91
91
  Requires-Dist: colorama ==0.4.6
92
92
  Requires-Dist: pyotp ==2.9.0
93
93
  Requires-Dist: mdurl ==0.1.2
@@ -5,7 +5,7 @@ sbase/steps.py,sha256=bKT_u5bJkKzYWEuAXi9NVVRYYxQRCM1_YJUrNFFRVPY,42865
5
5
  seleniumbase/ReadMe.md,sha256=4nEdto4d0Ch0Zneg0yAC-RBBdqRqPUP0SCo-ze_XDPM,3612
6
6
  seleniumbase/__init__.py,sha256=dgq30q6wGO2fJOVYemxC5hLxzv-of-MRn5P1YarBq5k,2263
7
7
  seleniumbase/__main__.py,sha256=dn1p6dgCchmcH1zzTzzQvFwwdQQqnTGH6ULV9m4hv24,654
8
- seleniumbase/__version__.py,sha256=stwURg1GlpTjB6ZfwxhyiJNFUEHUUu_ebog3IEpV2CQ,46
8
+ seleniumbase/__version__.py,sha256=5LdSq2oRCgT1RzNcyA-lqWKjAcD-Zx80dQ77gewKL18,46
9
9
  seleniumbase/behave/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  seleniumbase/behave/behave_helper.py,sha256=elkl8P9eLulRAioLstE9baYNM9N_PHBmAOcajX-pH_Y,24198
11
11
  seleniumbase/behave/behave_sb.py,sha256=q4uYZixZBf7VYWnQnEk2weTcyMy1X1faR3vyYvUzDiA,56406
@@ -40,7 +40,7 @@ seleniumbase/console_scripts/sb_print.py,sha256=yo641b_OdSE0GUauOyxk-QrNeIjYzbRY
40
40
  seleniumbase/console_scripts/sb_recorder.py,sha256=UQQhnAR18dbcC7ToDvj6TM2PIG5qBrNaekaM6kSK_E8,10970
41
41
  seleniumbase/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  seleniumbase/core/application_manager.py,sha256=e_0sjtI8cjY5BNyZj1QBR0j6_oCScxGmSXYEpcYwuZE,576
43
- seleniumbase/core/browser_launcher.py,sha256=n-1H_qn-TbfHNHuGX8r57A5-RdHbBUeixEZnjywBpM4,176623
43
+ seleniumbase/core/browser_launcher.py,sha256=SaXoKQkbybkJ8Sqi3FIsG8SInFYncRQTzAjar97HNlY,176804
44
44
  seleniumbase/core/capabilities_parser.py,sha256=meIS2uHapTCq2ldfNAToC7r0cKmZDRXuYNKExM1GHDY,6038
45
45
  seleniumbase/core/colored_traceback.py,sha256=DrRWfg7XEnKcgY59Xj7Jdk09H-XqHYBSUpB-DiZt6iY,2020
46
46
  seleniumbase/core/create_db_tables.sql,sha256=VWPtrdiW_HQ6yETHjqTu-VIrTwvd8I8o1NfBeaVSHpU,972
@@ -75,7 +75,7 @@ seleniumbase/fixtures/constants.py,sha256=TapuGLdERtvZPGMblVXkNGybr8tj8FMtN3sbJ3
75
75
  seleniumbase/fixtures/css_to_xpath.py,sha256=9ouDB1xl4MJ2os6JOgTIAyHKOQfuxtxvXC3O5hSnEKA,1954
76
76
  seleniumbase/fixtures/errors.py,sha256=KyxuEVx_e3MPhVrJfNIa_3ltMpbCFxfy_jxK8RFNTns,555
77
77
  seleniumbase/fixtures/js_utils.py,sha256=y1FgWvrg7CjryqGnFhbmFIIVYMzQfYZhwppYae87UCo,51158
78
- seleniumbase/fixtures/page_actions.py,sha256=YVbpdJpaJO-B7pkKw8hxEWpO9e3XraYle5FBJHdQ7Qw,62434
78
+ seleniumbase/fixtures/page_actions.py,sha256=lsat_gPsTwTsnqOrtCHZogDsufzMfUGjQ1ihiMjSeUk,62867
79
79
  seleniumbase/fixtures/page_utils.py,sha256=QmAvTlT0j0ESf1IgvyXwHJapJakFM7QqBLXnHXgaeJw,12596
80
80
  seleniumbase/fixtures/shared_utils.py,sha256=Fc78v0OxfLPOPqeT8ExsdkTgXHlmpxvJeLbLyDnu1dI,5748
81
81
  seleniumbase/fixtures/unittest_helper.py,sha256=sfZ92rZeBAn_sF_yQ3I6_I7h3lyU5-cV_UMegBNoEm8,1294
@@ -114,7 +114,7 @@ seleniumbase/translate/portuguese.py,sha256=x3P4qxp56UiI41GoaL7JbUvFRYsgXU1EKjTg
114
114
  seleniumbase/translate/russian.py,sha256=TyN9n0b4GRWDEYnHRGw1rfNAscdDmP3F3Y3aySM3C7s,27978
115
115
  seleniumbase/translate/spanish.py,sha256=hh3xgW1Pq122SHYVvJAxFaXhFrjniOVncVbJbfWqOUM,25528
116
116
  seleniumbase/translate/translator.py,sha256=yfoa4tCAbaD0W3gcbjsoGpNZjJdTY246W9uGuTlh4bw,49436
117
- seleniumbase/undetected/__init__.py,sha256=-4JWNgiUkuaCZWlB9pea7MiVZWiNJs7SICxu4yGD4s8,22074
117
+ seleniumbase/undetected/__init__.py,sha256=OCTExZ-VtAxMiarnpbPXurTTOp2-rBdqH2K7ywlZawk,22275
118
118
  seleniumbase/undetected/cdp.py,sha256=EralLQm8diG5i6EoHFXHIQEc7Uf7PWtzyPH_upS5RIs,4047
119
119
  seleniumbase/undetected/dprocess.py,sha256=WWQ_X_-Q7Lfx1m6oxkYHU0eTIc76Jodph4n1QnK4GEE,1706
120
120
  seleniumbase/undetected/options.py,sha256=SGuz8iqlVPYN7IexNiGauupWF0xP3mqO72-9tgIqeuI,2999
@@ -137,9 +137,9 @@ seleniumbase/utilities/selenium_grid/start-grid-hub.sh,sha256=KADv0RUHONLL2_I443
137
137
  seleniumbase/utilities/selenium_ide/ReadMe.md,sha256=hznGeuMpkIimqMiZBW-4goIy2ltW4l8X9kb0YSPUQfE,4483
138
138
  seleniumbase/utilities/selenium_ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
139
139
  seleniumbase/utilities/selenium_ide/convert_ide.py,sha256=pZFnqEJQEKZPyNFjkLD29s2HPQgCrWW9XJWpCPhWOoM,31691
140
- seleniumbase-4.28.1.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
141
- seleniumbase-4.28.1.dist-info/METADATA,sha256=ylhdl80ZhnKfg25y-FF9l8TAgBOhtVUKy8V02GKC9HQ,85546
142
- seleniumbase-4.28.1.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
143
- seleniumbase-4.28.1.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
144
- seleniumbase-4.28.1.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
145
- seleniumbase-4.28.1.dist-info/RECORD,,
140
+ seleniumbase-4.28.2.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
141
+ seleniumbase-4.28.2.dist-info/METADATA,sha256=4Tzxn1C24HxU7bFYBN93SWfE-YAQPQwqShJcXwDtUlA,85546
142
+ seleniumbase-4.28.2.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
143
+ seleniumbase-4.28.2.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
144
+ seleniumbase-4.28.2.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
145
+ seleniumbase-4.28.2.dist-info/RECORD,,