seleniumbase 4.26.2__py3-none-any.whl → 4.26.3__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.26.2"
2
+ __version__ = "4.26.3"
@@ -60,6 +60,7 @@ from selenium.common.exceptions import (
60
60
  from selenium.webdriver.common.by import By
61
61
  from selenium.webdriver.common.keys import Keys
62
62
  from selenium.webdriver.remote.remote_connection import LOGGER
63
+ from selenium.webdriver.remote.webelement import WebElement
63
64
  from seleniumbase import config as sb_config
64
65
  from seleniumbase.__version__ import __version__
65
66
  from seleniumbase.common import decorators
@@ -5645,6 +5646,40 @@ class BaseCase(unittest.TestCase):
5645
5646
  if self.is_element_visible(selector, by=by):
5646
5647
  self.__highlight(selector, by=by, loops=loops, scroll=scroll)
5647
5648
 
5649
+ def __highlight_element(self, element, loops=None, scroll=True):
5650
+ self.__check_scope()
5651
+ if not loops:
5652
+ loops = settings.HIGHLIGHTS
5653
+ if scroll and self.browser != "safari":
5654
+ try:
5655
+ self.__slow_scroll_to_element(element)
5656
+ except Exception:
5657
+ pass
5658
+ if self.highlights:
5659
+ loops = self.highlights
5660
+ if self.browser == "ie":
5661
+ loops = 1 # Override previous setting because IE is slow
5662
+ loops = int(loops)
5663
+ if self.headless or self.headless2 or self.xvfb:
5664
+ # Headless modes have less need for highlighting elements.
5665
+ # However, highlight() may be used as a sleep alternative.
5666
+ loops = int(math.ceil(loops * 0.5))
5667
+ o_bs = "" # original_box_shadow
5668
+ try:
5669
+ style = element.get_attribute("style")
5670
+ except Exception:
5671
+ self.wait_for_ready_state_complete()
5672
+ time.sleep(0.12)
5673
+ style = element.get_attribute("style")
5674
+ if style:
5675
+ if "box-shadow: " in style:
5676
+ box_start = style.find("box-shadow: ")
5677
+ box_end = style.find(";", box_start) + 1
5678
+ original_box_shadow = style[box_start:box_end]
5679
+ o_bs = original_box_shadow
5680
+ self.__highlight_element_with_js(element, loops, o_bs)
5681
+ time.sleep(0.065)
5682
+
5648
5683
  def __highlight(
5649
5684
  self, selector, by="css selector", loops=None, scroll=True
5650
5685
  ):
@@ -5733,13 +5768,16 @@ class BaseCase(unittest.TestCase):
5733
5768
  ):
5734
5769
  """This method uses fancy JavaScript to highlight an element.
5735
5770
  @Params
5736
- selector - the selector of the element to find
5771
+ selector - the selector of the element to find (Accepts WebElement)
5737
5772
  by - the type of selector to search by (Default: CSS)
5738
5773
  loops - # of times to repeat the highlight animation
5739
5774
  (Default: 4. Each loop lasts for about 0.2s)
5740
5775
  scroll - the option to scroll to the element first (Default: True)
5741
5776
  timeout - the time to wait for the element to appear """
5742
5777
  self.__check_scope()
5778
+ if isinstance(selector, WebElement):
5779
+ self.__highlight_element(selector, loops=loops, scroll=scroll)
5780
+ return
5743
5781
  if not timeout:
5744
5782
  timeout = settings.SMALL_TIMEOUT
5745
5783
  self.wait_for_element_visible(selector, by=by, timeout=timeout)
@@ -5751,6 +5789,31 @@ class BaseCase(unittest.TestCase):
5751
5789
  action = ["hi_li", selector, origin, time_stamp]
5752
5790
  self.__extra_actions.append(action)
5753
5791
 
5792
+ def highlight_elements(
5793
+ self,
5794
+ selector,
5795
+ by="css selector",
5796
+ loops=None,
5797
+ scroll=True,
5798
+ limit=0,
5799
+ ):
5800
+ if not limit:
5801
+ limit = 0 # 0 means no limit
5802
+ limit = int(limit)
5803
+ count = 0
5804
+ elements = self.find_elements(selector, by=by)
5805
+ for element in elements:
5806
+ try:
5807
+ if element.is_displayed():
5808
+ self.__highlight_element(
5809
+ element, loops=loops, scroll=scroll
5810
+ )
5811
+ count += 1
5812
+ except Exception:
5813
+ pass
5814
+ if limit > 0 and count >= limit:
5815
+ break
5816
+
5754
5817
  def press_up_arrow(self, selector="html", times=1, by="css selector"):
5755
5818
  """Simulates pressing the UP Arrow on the keyboard.
5756
5819
  By default, "html" will be used as the CSS Selector target.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: seleniumbase
3
- Version: 4.26.2
3
+ Version: 4.26.3
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
@@ -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=Mw4ShIWUF2Efjx-JuwUQLWF9nIbxcX-vu9AOGBp32ec,2123
7
7
  seleniumbase/__main__.py,sha256=dn1p6dgCchmcH1zzTzzQvFwwdQQqnTGH6ULV9m4hv24,654
8
- seleniumbase/__version__.py,sha256=IdsM5krAJIinwIWiyshCDLrFMi6Bi4YJ6a8NCuZlhe0,46
8
+ seleniumbase/__version__.py,sha256=FFWk8j6zhXWDYdLew6Aj1jcg3AsMK8J44UaJpDRfpws,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=rpSKGufjzKeoiTqsr1HChNu1fY68CMirr5mgff--LHs,56291
@@ -70,7 +70,7 @@ seleniumbase/extensions/disable_csp.zip,sha256=YMifIIgEBiLrEFrS1sfW4Exh4br1V4oK1
70
70
  seleniumbase/extensions/recorder.zip,sha256=dE3-vt1lsIyMbz3MD0WboizA5KiR3SH2jxAMrC0T_cU,11908
71
71
  seleniumbase/extensions/sbase_ext.zip,sha256=3s1N8zrVaMz8RQEOIoBzC3KDjtmHwVZRvVsX25Odr_s,8175
72
72
  seleniumbase/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- seleniumbase/fixtures/base_case.py,sha256=3IkDFD7nEBv6RXdX3XUva98UXQS8Flfl5x-qwXlb9Lk,688938
73
+ seleniumbase/fixtures/base_case.py,sha256=IOSN4C10oS-xv_euTU99mZ3vunySXwx9Sr5tShAn2B0,691243
74
74
  seleniumbase/fixtures/constants.py,sha256=Uvr5-Z8ZfiE2-lIqJS1CQ0tkmQ6qJYooCOTo_HMleo4,13348
75
75
  seleniumbase/fixtures/css_to_xpath.py,sha256=9ouDB1xl4MJ2os6JOgTIAyHKOQfuxtxvXC3O5hSnEKA,1954
76
76
  seleniumbase/fixtures/errors.py,sha256=KyxuEVx_e3MPhVrJfNIa_3ltMpbCFxfy_jxK8RFNTns,555
@@ -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.26.2.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
141
- seleniumbase-4.26.2.dist-info/METADATA,sha256=_jN1hMI0IUttrMRfBBhaHYVbARfTPtY64vFqzMdCagc,84898
142
- seleniumbase-4.26.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
143
- seleniumbase-4.26.2.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
144
- seleniumbase-4.26.2.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
145
- seleniumbase-4.26.2.dist-info/RECORD,,
140
+ seleniumbase-4.26.3.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
141
+ seleniumbase-4.26.3.dist-info/METADATA,sha256=IBs2oYYeZBIZKe_U9KREMujzQhZUCmQdzpiGfPtZI74,84898
142
+ seleniumbase-4.26.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
143
+ seleniumbase-4.26.3.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
144
+ seleniumbase-4.26.3.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
145
+ seleniumbase-4.26.3.dist-info/RECORD,,