Skip to content

Commit 8803a24

Browse files
authored
Merge pull request #345 from seleniumbase/small-updates
Small updates to reliability and logging
2 parents 2656a5d + ba8c74d commit 8803a24

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

examples/my_first_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_basic(self):
4343
#
4444
# 2. Most methods have the optional `timeout` argument. Ex:
4545
# [
46-
# self.get_text('div center', timeout=15)
46+
# self.get_text("#content", timeout=15)
4747
# ]
4848
# The `timeout` argument tells the method how many seconds to wait
4949
# for an element to appear before raising an exception. This is
@@ -53,17 +53,17 @@ def test_basic(self):
5353
#
5454
# 3. There's usually more than one way to do the same thing. Ex:
5555
# [
56-
# self.assert_text('free to copy', 'div center')
56+
# self.assert_text("Hooray robots!", "#content")
5757
# ]
5858
# Is the same as:
5959
# [
60-
# text = self.get_text("div center")
61-
# self.assert_true("free to copy" in text)
60+
# text = self.get_text("#content")
61+
# self.assert_true("Hooray robots!" in text)
6262
# ]
6363
# Or:
6464
# [
65-
# text = self.find_element('div center').text
66-
# assert("free to copy" in text)
65+
# text = self.find_element("#content").text
66+
# assert("Hooray robots!" in text)
6767
# ]
6868
#
6969
# And the following line:

seleniumbase/fixtures/base_case.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def test_anything(self):
5454
from seleniumbase.fixtures import page_actions
5555
from seleniumbase.fixtures import page_utils
5656
from seleniumbase.fixtures import xpath_to_css
57+
logging.getLogger("requests").setLevel(logging.ERROR)
58+
logging.getLogger("urllib3").setLevel(logging.ERROR)
5759
urllib3.disable_warnings()
5860
ENI_Exception = selenium_exceptions.ElementNotInteractableException
5961

@@ -1464,7 +1466,14 @@ def highlight(self, selector, by=By.CSS_SELECTOR,
14641466
loops = int(loops)
14651467

14661468
o_bs = '' # original_box_shadow
1467-
style = element.get_attribute('style')
1469+
try:
1470+
style = element.get_attribute('style')
1471+
except (StaleElementReferenceException, ENI_Exception):
1472+
self.wait_for_ready_state_complete()
1473+
time.sleep(0.05)
1474+
element = self.wait_for_element_visible(
1475+
selector, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT)
1476+
style = element.get_attribute('style')
14681477
if style:
14691478
if 'box-shadow: ' in style:
14701479
box_start = style.find('box-shadow: ')
@@ -3116,7 +3125,14 @@ def __highlight_with_assert_success(
31163125
self.__slow_scroll_to_element(element)
31173126

31183127
o_bs = '' # original_box_shadow
3119-
style = element.get_attribute('style')
3128+
try:
3129+
style = element.get_attribute('style')
3130+
except (StaleElementReferenceException, ENI_Exception):
3131+
self.wait_for_ready_state_complete()
3132+
time.sleep(0.05)
3133+
element = self.wait_for_element_visible(
3134+
selector, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT)
3135+
style = element.get_attribute('style')
31203136
if style:
31213137
if 'box-shadow: ' in style:
31223138
box_start = style.find('box-shadow: ')

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setup(
1919
name='seleniumbase',
20-
version='1.25.3',
20+
version='1.25.4',
2121
description='Reliable Browser Automation & Testing Framework',
2222
long_description=long_description,
2323
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)