Skip to content

Commit 3cedb5a

Browse files
committed
Update demo-mode reliability
1 parent 2656a5d commit 3cedb5a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,14 @@ def highlight(self, selector, by=By.CSS_SELECTOR,
14641464
loops = int(loops)
14651465

14661466
o_bs = '' # original_box_shadow
1467-
style = element.get_attribute('style')
1467+
try:
1468+
style = element.get_attribute('style')
1469+
except (StaleElementReferenceException, ENI_Exception):
1470+
self.wait_for_ready_state_complete()
1471+
time.sleep(0.05)
1472+
element = self.wait_for_element_visible(
1473+
selector, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT)
1474+
style = element.get_attribute('style')
14681475
if style:
14691476
if 'box-shadow: ' in style:
14701477
box_start = style.find('box-shadow: ')
@@ -3116,7 +3123,14 @@ def __highlight_with_assert_success(
31163123
self.__slow_scroll_to_element(element)
31173124

31183125
o_bs = '' # original_box_shadow
3119-
style = element.get_attribute('style')
3126+
try:
3127+
style = element.get_attribute('style')
3128+
except (StaleElementReferenceException, ENI_Exception):
3129+
self.wait_for_ready_state_complete()
3130+
time.sleep(0.05)
3131+
element = self.wait_for_element_visible(
3132+
selector, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT)
3133+
style = element.get_attribute('style')
31203134
if style:
31213135
if 'box-shadow: ' in style:
31223136
box_start = style.find('box-shadow: ')

0 commit comments

Comments
 (0)