I'm trying to wait the webpage to fully load before I proceed and find some elements.
1. If I do
EC.presence_of_element_located((By.XPATH, "//*[contains(text(), 'my text 1234567')]"))
I will get
<selenium.webdriver.support.expected_conditions.presence_of_element_located at 0x143304641c0>
This means my text is found right?
2. But If I do
WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.XPATH, "//*[contains(text(), 'my text 1234567')]")))
I will get
selenium.common.exceptions.TimeoutException: Message:
3. Then I checked
driver.find_elements_by_xpath("//*[contains(text(), 'my text 1234567')]")
Out[55]: []
4. If I do
driver.page_source.find('my text 1234567')
Out[64]: 971
I'm very confused. Why these would happen? Should I modify my By.XPATH?
Problem solved following below answer
Changed
"//*[contains(text(), 'my text 1234567')]"
to
"//*[contains(., 'my text 1234567')]"
Why text() here won't work?