diff --git a/py/selenium/webdriver/support/expected_conditions.py b/py/selenium/webdriver/support/expected_conditions.py index c4f9a243581c5..71d9f0b841f0d 100644 --- a/py/selenium/webdriver/support/expected_conditions.py +++ b/py/selenium/webdriver/support/expected_conditions.py @@ -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