How can I wait for a presence of an element which the content (text) is not empty? I tried select by xpath using //*[@id="test" and text() != ""]
, but the return of WebDriverWait#until
does not retrieve the element.
My code:
selector = '//*[@id="test" and text() != ""]'
element = WebDriverWait(driver, timeout).until(
expected_conditions.presence_of_element_located((By.XPATH, selector))
)
I would like to get the text content of the element. I tried:
print element.text # prints 0
If i print only element
, the output is <selenium.webdriver.remote.webelement.WebElement(session="xxx", element="xxx")>
. What is wrong?
The div I'm tryin to get has this structure:
<div>
Test:
<div id="test"><b>this text here</b></div>
</div>