seleniumbase 4.32.6__py3-none-any.whl → 4.32.8__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.32.6"
2
+ __version__ = "4.32.8"
@@ -625,6 +625,7 @@ def uc_open_with_cdp_mode(driver, url=None):
625
625
  cdp.internalize_links = CDPM.internalize_links
626
626
  cdp.get_window = CDPM.get_window
627
627
  cdp.get_element_attributes = CDPM.get_element_attributes
628
+ cdp.get_element_attribute = CDPM.get_element_attribute
628
629
  cdp.get_element_html = CDPM.get_element_html
629
630
  cdp.get_element_rect = CDPM.get_element_rect
630
631
  cdp.get_element_size = CDPM.get_element_size
@@ -651,6 +652,11 @@ def uc_open_with_cdp_mode(driver, url=None):
651
652
  cdp.focus = CDPM.focus
652
653
  cdp.highlight_overlay = CDPM.highlight_overlay
653
654
  cdp.get_window_position = CDPM.get_window_position
655
+ cdp.check_if_unchecked = CDPM.check_if_unchecked
656
+ cdp.uncheck_if_checked = CDPM.uncheck_if_checked
657
+ cdp.select_if_unselected = CDPM.select_if_unselected
658
+ cdp.unselect_if_selected = CDPM.unselect_if_selected
659
+ cdp.is_checked = CDPM.is_checked
654
660
  cdp.is_element_present = CDPM.is_element_present
655
661
  cdp.is_element_visible = CDPM.is_element_visible
656
662
  cdp.assert_element_present = CDPM.assert_element_present
@@ -2128,6 +2134,10 @@ def _set_chrome_options(
2128
2134
  binary_loc = detect_b_ver.get_binary_location(br_app, True)
2129
2135
  if os.path.exists(binary_loc):
2130
2136
  binary_location = binary_loc
2137
+ elif os.path.exists("/usr/bin/google-chrome-stable"):
2138
+ binary_location = "/usr/bin/google-chrome-stable"
2139
+ elif os.path.exists("/usr/bin/google-chrome"):
2140
+ binary_location = "/usr/bin/google-chrome"
2131
2141
  extra_disabled_features = []
2132
2142
  if chromium_arg:
2133
2143
  # Can be a comma-separated list of Chromium args or a list
@@ -2228,6 +2238,8 @@ def _set_chrome_options(
2228
2238
  chrome_options.add_argument("--wm-window-animations-disabled")
2229
2239
  chrome_options.add_argument("--enable-privacy-sandbox-ads-apis")
2230
2240
  chrome_options.add_argument("--disable-background-timer-throttling")
2241
+ # Prevent new tabs opened by Selenium from being blocked:
2242
+ chrome_options.add_argument("--disable-popup-blocking")
2231
2243
  # Skip remaining options that trigger anti-bot services
2232
2244
  return chrome_options
2233
2245
  chrome_options.add_argument("--test-type")
@@ -1,6 +1,5 @@
1
1
  """Add CDP methods to extend the driver"""
2
2
  import fasteners
3
- import math
4
3
  import os
5
4
  import re
6
5
  import sys
@@ -771,10 +770,12 @@ class CDPMethods():
771
770
  window_rect = self.get_window_rect()
772
771
  w_bottom_y = window_rect["y"] + window_rect["height"]
773
772
  viewport_height = window_rect["innerHeight"]
774
- x = math.ceil(window_rect["x"] + element_rect["x"])
775
- y = math.ceil(w_bottom_y - viewport_height + element_rect["y"])
773
+ x = window_rect["x"] + element_rect["x"]
774
+ y = w_bottom_y - viewport_height + element_rect["y"]
776
775
  y_scroll_offset = window_rect["pageYOffset"]
777
- y = int(y - y_scroll_offset)
776
+ y = y - y_scroll_offset
777
+ x = x + window_rect["scrollX"]
778
+ y = y + window_rect["scrollY"]
778
779
  return ({"height": e_height, "width": e_width, "x": x, "y": y})
779
780
 
780
781
  def get_gui_element_center(self, selector):
@@ -804,6 +805,10 @@ class CDPMethods():
804
805
  )
805
806
  )
806
807
 
808
+ def get_element_attribute(self, selector, attribute):
809
+ attributes = self.get_element_attributes(selector)
810
+ return attributes[attribute]
811
+
807
812
  def get_element_html(self, selector):
808
813
  selector = self.__convert_to_css_if_xpath(selector)
809
814
  return self.loop.run_until_complete(
@@ -1033,6 +1038,28 @@ class CDPMethods():
1033
1038
  This prevents those links from opening in a new tab."""
1034
1039
  self.set_attributes('[target="_blank"]', "target", "_self")
1035
1040
 
1041
+ def is_checked(self, selector):
1042
+ """Return True if checkbox (or radio button) is checked."""
1043
+ self.find_element(selector, timeout=settings.SMALL_TIMEOUT)
1044
+ return self.get_element_attribute(selector, "checked")
1045
+
1046
+ def is_selected(self, selector):
1047
+ return self.is_checked(selector)
1048
+
1049
+ def check_if_unchecked(self, selector):
1050
+ if not self.is_checked(selector):
1051
+ self.click(selector)
1052
+
1053
+ def select_if_unselected(self, selector):
1054
+ self.check_if_unchecked(selector)
1055
+
1056
+ def uncheck_if_checked(self, selector):
1057
+ if self.is_checked(selector):
1058
+ self.click(selector)
1059
+
1060
+ def unselect_if_selected(self, selector):
1061
+ self.uncheck_if_checked(selector)
1062
+
1036
1063
  def is_element_present(self, selector):
1037
1064
  try:
1038
1065
  self.select(selector, timeout=0.01)
@@ -1884,6 +1884,8 @@ class BaseCase(unittest.TestCase):
1884
1884
  if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
1885
1885
  timeout = self.__get_new_timeout(timeout)
1886
1886
  selector, by = self.__recalculate_selector(selector, by)
1887
+ if self.__is_cdp_swap_needed():
1888
+ return self.cdp.get_element_attribute(selector)
1887
1889
  self.wait_for_ready_state_complete()
1888
1890
  time.sleep(0.01)
1889
1891
  if self.__is_shadow_selector(selector):
@@ -2460,16 +2462,14 @@ class BaseCase(unittest.TestCase):
2460
2462
  if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
2461
2463
  timeout = self.__get_new_timeout(timeout)
2462
2464
  selector, by = self.__recalculate_selector(selector, by)
2465
+ if self.__is_cdp_swap_needed():
2466
+ return self.cdp.is_checked(selector)
2463
2467
  kind = self.get_attribute(selector, "type", by=by, timeout=timeout)
2464
2468
  if kind != "checkbox" and kind != "radio":
2465
2469
  raise Exception("Expecting a checkbox or a radio button element!")
2466
- is_checked = self.get_attribute(
2470
+ return self.get_attribute(
2467
2471
  selector, "checked", by=by, timeout=timeout, hard_fail=False
2468
2472
  )
2469
- if is_checked:
2470
- return True
2471
- else: # (NoneType)
2472
- return False
2473
2473
 
2474
2474
  def is_selected(self, selector, by="css selector", timeout=None):
2475
2475
  """Same as is_checked()"""
@@ -2479,6 +2479,9 @@ class BaseCase(unittest.TestCase):
2479
2479
  """If a checkbox or radio button is not checked, will check it."""
2480
2480
  self.__check_scope()
2481
2481
  selector, by = self.__recalculate_selector(selector, by)
2482
+ if self.__is_cdp_swap_needed():
2483
+ self.cdp.check_if_unchecked(selector)
2484
+ return
2482
2485
  if not self.is_checked(selector, by=by):
2483
2486
  if self.is_element_visible(selector, by=by):
2484
2487
  self.click(selector, by=by)
@@ -2515,6 +2518,9 @@ class BaseCase(unittest.TestCase):
2515
2518
  """If a checkbox is checked, will uncheck it."""
2516
2519
  self.__check_scope()
2517
2520
  selector, by = self.__recalculate_selector(selector, by)
2521
+ if self.__is_cdp_swap_needed():
2522
+ self.cdp.uncheck_if_checked(selector)
2523
+ return
2518
2524
  if self.is_checked(selector, by=by):
2519
2525
  if self.is_element_visible(selector, by=by):
2520
2526
  self.click(selector, by=by)
@@ -6087,6 +6093,9 @@ class BaseCase(unittest.TestCase):
6087
6093
  timeout = settings.SMALL_TIMEOUT
6088
6094
  if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
6089
6095
  timeout = self.__get_new_timeout(timeout)
6096
+ if self.__is_cdp_swap_needed():
6097
+ self.cdp.scroll_into_view(selector)
6098
+ return
6090
6099
  if self.demo_mode or self.slow_mode:
6091
6100
  self.slow_scroll_to(selector, by=by, timeout=timeout)
6092
6101
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: seleniumbase
3
- Version: 4.32.6
3
+ Version: 4.32.8
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
@@ -80,7 +80,7 @@ Requires-Dist: colorama>=0.4.6
80
80
  Requires-Dist: pyyaml>=6.0.2
81
81
  Requires-Dist: pygments>=2.18.0
82
82
  Requires-Dist: tabcompleter>=1.4.0
83
- Requires-Dist: pdbp>=1.6.0
83
+ Requires-Dist: pdbp>=1.6.1
84
84
  Requires-Dist: idna==3.10
85
85
  Requires-Dist: chardet==5.2.0
86
86
  Requires-Dist: charset-normalizer==3.4.0
@@ -112,7 +112,7 @@ Requires-Dist: beautifulsoup4==4.12.3
112
112
  Requires-Dist: pyotp==2.9.0
113
113
  Requires-Dist: markdown-it-py==3.0.0
114
114
  Requires-Dist: mdurl==0.1.2
115
- Requires-Dist: rich==13.9.3
115
+ Requires-Dist: rich==13.9.4
116
116
  Requires-Dist: python-xlib==0.33; platform_system == "Linux"
117
117
  Requires-Dist: pyreadline3>=3.5.3; platform_system == "Windows"
118
118
  Requires-Dist: setuptools~=70.2; python_version < "3.10"
@@ -3,7 +3,7 @@ sbase/__main__.py,sha256=G0bVB1-DM4PGwQ1KyOupaWCs4ePbChZNNWuX2htim5U,647
3
3
  sbase/steps.py,sha256=bKT_u5bJkKzYWEuAXi9NVVRYYxQRCM1_YJUrNFFRVPY,42865
4
4
  seleniumbase/__init__.py,sha256=OtJh8nGKL4xtZpw8KPqmn7Q6R-86t4cWUDyVF5MbMTo,2398
5
5
  seleniumbase/__main__.py,sha256=dn1p6dgCchmcH1zzTzzQvFwwdQQqnTGH6ULV9m4hv24,654
6
- seleniumbase/__version__.py,sha256=wAXyEEclh19-S_AccLbHaXc0WZvMuumYg0QJ5D4l99w,46
6
+ seleniumbase/__version__.py,sha256=4vxqPf3tt44pMrMcI7vtp034yhLK0HPRb3dBIbALHDE,46
7
7
  seleniumbase/behave/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  seleniumbase/behave/behave_helper.py,sha256=elkl8P9eLulRAioLstE9baYNM9N_PHBmAOcajX-pH_Y,24198
9
9
  seleniumbase/behave/behave_sb.py,sha256=-hza7Nx2U41mSObYiPMi48v3JlPh3sJO3yzP0kqZ1Gk,59174
@@ -36,7 +36,7 @@ seleniumbase/console_scripts/sb_print.py,sha256=tNy-bMDgwHJO3bZxMpmo9weSE8uhbH0C
36
36
  seleniumbase/console_scripts/sb_recorder.py,sha256=1oAA4wFzVboNhIFDwJLD3jgy9RuoavywKQG7R67bNZE,10908
37
37
  seleniumbase/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  seleniumbase/core/application_manager.py,sha256=e_0sjtI8cjY5BNyZj1QBR0j6_oCScxGmSXYEpcYwuZE,576
39
- seleniumbase/core/browser_launcher.py,sha256=_Akzkw-q0nyxf3GL5ci5PSQykEHzgsUs0TzGb7Z4ZmE,216518
39
+ seleniumbase/core/browser_launcher.py,sha256=p2L-Yl_r8yN7t9TuTNgJnMlV4EguT49Nd0Oc_OwOZCw,217230
40
40
  seleniumbase/core/capabilities_parser.py,sha256=meIS2uHapTCq2ldfNAToC7r0cKmZDRXuYNKExM1GHDY,6038
41
41
  seleniumbase/core/colored_traceback.py,sha256=DrRWfg7XEnKcgY59Xj7Jdk09H-XqHYBSUpB-DiZt6iY,2020
42
42
  seleniumbase/core/create_db_tables.sql,sha256=VWPtrdiW_HQ6yETHjqTu-VIrTwvd8I8o1NfBeaVSHpU,972
@@ -50,7 +50,7 @@ seleniumbase/core/proxy_helper.py,sha256=cXhu8ErK9Vjdm82RMaQj7hEq_yUWizSp6LyiD50
50
50
  seleniumbase/core/recorder_helper.py,sha256=fNGjbapXmEsht54x1o6Igk198QdnPxDDnjUOzQxNhNQ,25055
51
51
  seleniumbase/core/report_helper.py,sha256=AIl6Qava2yW1uSzbLpJBlPlYDz0KE-rVhogh8hsGWBo,12201
52
52
  seleniumbase/core/s3_manager.py,sha256=bkeI8I4y19ebWuQG1oEZV5qJbotC6eN8vin31OCNWJk,3521
53
- seleniumbase/core/sb_cdp.py,sha256=ZuK55SpMu199j0ZI1tJCip8ruM7YR2FH0m0hsATxbxY,43260
53
+ seleniumbase/core/sb_cdp.py,sha256=0B_3MSfNdh-3Q5UCvIezMBXebwmcRVhR5Ugkkqz0UNA,44183
54
54
  seleniumbase/core/sb_driver.py,sha256=-k4vHwMnuiBIkdVInTtJA-IDLrgQfyMhNxSHMIsjepw,11623
55
55
  seleniumbase/core/session_helper.py,sha256=s9zD3PVZEWVzG2h81cCUskbNWLfdjC_LwwQjKptHCak,558
56
56
  seleniumbase/core/settings_parser.py,sha256=KokVXpCiGZhJ-D4Bo-hizPz5r-iefzWoiTANu9zNaq4,7504
@@ -65,7 +65,7 @@ seleniumbase/extensions/disable_csp.zip,sha256=YMifIIgEBiLrEFrS1sfW4Exh4br1V4oK1
65
65
  seleniumbase/extensions/recorder.zip,sha256=OOyzF-Ize2cSRu1CqhzSAq5vusI9hqLLd2OIApUHesI,11918
66
66
  seleniumbase/extensions/sbase_ext.zip,sha256=3s1N8zrVaMz8RQEOIoBzC3KDjtmHwVZRvVsX25Odr_s,8175
67
67
  seleniumbase/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
- seleniumbase/fixtures/base_case.py,sha256=ChVH_uQqjXwTHI9Q7V17Wixdc75KIEFz-E70Eu871Es,711157
68
+ seleniumbase/fixtures/base_case.py,sha256=DfOl1L5VCOaKduVqvnkBeUc4qHs3n6SEdl65CLXaEFs,711565
69
69
  seleniumbase/fixtures/constants.py,sha256=XYYMpB-ZDI756LvfhSK9RxdqQ_qO9fJVXgBqBYlQNkk,13609
70
70
  seleniumbase/fixtures/css_to_xpath.py,sha256=9ouDB1xl4MJ2os6JOgTIAyHKOQfuxtxvXC3O5hSnEKA,1954
71
71
  seleniumbase/fixtures/errors.py,sha256=KyxuEVx_e3MPhVrJfNIa_3ltMpbCFxfy_jxK8RFNTns,555
@@ -135,9 +135,9 @@ seleniumbase/utilities/selenium_grid/start-grid-hub.bat,sha256=Ftq-GrAKRYH2ssDPr
135
135
  seleniumbase/utilities/selenium_grid/start-grid-hub.sh,sha256=KADv0RUHONLL2_I443QFK8PryBpDmKn5Gy0s4o0vDSM,106
136
136
  seleniumbase/utilities/selenium_ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
137
137
  seleniumbase/utilities/selenium_ide/convert_ide.py,sha256=pZFnqEJQEKZPyNFjkLD29s2HPQgCrWW9XJWpCPhWOoM,31691
138
- seleniumbase-4.32.6.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
139
- seleniumbase-4.32.6.dist-info/METADATA,sha256=ZarfkQ9ZflgrCn_6rEmFia96KZ5naSeV7vUflbE8AJY,86380
140
- seleniumbase-4.32.6.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
141
- seleniumbase-4.32.6.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
142
- seleniumbase-4.32.6.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
143
- seleniumbase-4.32.6.dist-info/RECORD,,
138
+ seleniumbase-4.32.8.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
139
+ seleniumbase-4.32.8.dist-info/METADATA,sha256=3sk3bpk1UBB7K_jHCYyHcx8ol_tCtXdH5upksSf4gU8,86380
140
+ seleniumbase-4.32.8.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
141
+ seleniumbase-4.32.8.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
142
+ seleniumbase-4.32.8.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
143
+ seleniumbase-4.32.8.dist-info/RECORD,,