Skip to content

Commit

Permalink
[py]: πŸš€ Improve performance (#11310)
Browse files Browse the repository at this point in the history
* Improve performance - reduce `find_element` calls

* Reduce calls to `get_attribute`

Co-authored-by: Simon K <jackofspaces@gmail.com>
  • Loading branch information
fenilgmehta and symonk committed Dec 1, 2022
1 parent 8b6dbb3 commit 409b057
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py/selenium/webdriver/support/expected_conditions.py
Expand Up @@ -234,9 +234,9 @@ def text_to_be_present_in_element_attribute(locator, attribute_, text_):

def _predicate(driver):
try:
if not element_attribute_to_include(locator, attribute_)(driver):
return False
element_text = driver.find_element(*locator).get_attribute(attribute_)
if element_text is None:
return False
return text_ in element_text
except StaleElementReferenceException:
return False
Expand Down

0 comments on commit 409b057

Please sign in to comment.