Use visibility_of_element_located()
instead of presence_of_element_located()
and following css selector
to identify the element.
driver.get("https://www.hko.gov.hk/en/gts/time/clock_e.html")
print(WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, 'div#hkoClock_Time'))).get_attribute("innerText"))
print(WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, 'div#hkoClock_Time'))).text)
Or you can use following xpath
as well
driver.get("https://www.hko.gov.hk/en/gts/time/clock_e.html")
print(WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.XPATH, '//div[@id="hkoClock_Time"]'))).get_attribute("innerText"))
print(WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.XPATH, '//div[@id="hkoClock_Time"]'))).text)