Skip to content

Small updates to reliability and logging #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/my_first_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_basic(self):
#
# 2. Most methods have the optional `timeout` argument. Ex:
# [
# self.get_text('div center', timeout=15)
# self.get_text("#content", timeout=15)
# ]
# The `timeout` argument tells the method how many seconds to wait
# for an element to appear before raising an exception. This is
Expand All @@ -53,17 +53,17 @@ def test_basic(self):
#
# 3. There's usually more than one way to do the same thing. Ex:
# [
# self.assert_text('free to copy', 'div center')
# self.assert_text("Hooray robots!", "#content")
# ]
# Is the same as:
# [
# text = self.get_text("div center")
# self.assert_true("free to copy" in text)
# text = self.get_text("#content")
# self.assert_true("Hooray robots!" in text)
# ]
# Or:
# [
# text = self.find_element('div center').text
# assert("free to copy" in text)
# text = self.find_element("#content").text
# assert("Hooray robots!" in text)
# ]
#
# And the following line:
Expand Down
20 changes: 18 additions & 2 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def test_anything(self):
from seleniumbase.fixtures import page_actions
from seleniumbase.fixtures import page_utils
from seleniumbase.fixtures import xpath_to_css
logging.getLogger("requests").setLevel(logging.ERROR)
logging.getLogger("urllib3").setLevel(logging.ERROR)
urllib3.disable_warnings()
ENI_Exception = selenium_exceptions.ElementNotInteractableException

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

o_bs = '' # original_box_shadow
style = element.get_attribute('style')
try:
style = element.get_attribute('style')
except (StaleElementReferenceException, ENI_Exception):
self.wait_for_ready_state_complete()
time.sleep(0.05)
element = self.wait_for_element_visible(
selector, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT)
style = element.get_attribute('style')
if style:
if 'box-shadow: ' in style:
box_start = style.find('box-shadow: ')
Expand Down Expand Up @@ -3116,7 +3125,14 @@ def __highlight_with_assert_success(
self.__slow_scroll_to_element(element)

o_bs = '' # original_box_shadow
style = element.get_attribute('style')
try:
style = element.get_attribute('style')
except (StaleElementReferenceException, ENI_Exception):
self.wait_for_ready_state_complete()
time.sleep(0.05)
element = self.wait_for_element_visible(
selector, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT)
style = element.get_attribute('style')
if style:
if 'box-shadow: ' in style:
box_start = style.find('box-shadow: ')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

setup(
name='seleniumbase',
version='1.25.3',
version='1.25.4',
description='Reliable Browser Automation & Testing Framework',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down