I write a program with selenium in python. My goal is to find the src of the video in the page. This is my code
video_element = chrome_driver.find_element_by_tag_name("video")
video_src = video_element.get_attribute("src")
When I try to check video_src
I get an empty string, however if I put time.sleep(1)
before I try to acquire the src I get the real link to the video.
I have tried to use WebDriverWait
instead of time.wait
like so
video_element = WebDriverWait(chrome_driver, 3).until(
expected_conditions.element_to_be_clickable((By.TAG_NAME, "video"))
)
But I couldn't find any condition that waits until the src tag is filled with the real link. Is there a way to wait with selenium instead of time? (with time it is not guarantee that the src will be filled)