I am trying to get selenium to wait for the page to load using a specific id that is nested with in other HTML; which I don't have much experience with. The id I am using is icon
, which is the zoom functionality. How would I select this id vs. top level id? The task I am attempting to preform is doing so before the page is loaded and I need the page fully loaded before any other actions proceed.
This is the code I have so far but currently it times out and continually reloads trying to find the id.
delay = 60
for i, c in enumerate(coordinates):
try:
filepath = file + str(i) + '.png'
lat, lon = c.split(';')
url = "https://earth.google.com/web/@{},{},1573.2221546a,277.89739987d,35y,0.69169508h,0.45101597t,-0r".format(lat, lon)
driver.get(url)
WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.ID, 'icon')))
driver.save_screenshot(filepath)
break
except TimeoutException:
print ("Loading took too much time!")