You can use WebDriverWait() to achieve that. For example, the following code waits for five hours or until it finds the element.
hours_to_wait = 5
element = WebDriverWait(driver, hours_to_wait *60*60).until(
EC.visibility_of_all_elements_located((By.XPATH, 'hereIsYourXpath')))
Or:
element = WebDriverWait(driver, hours_to_wait *60*60).until(
EC.presence_of_element_located((By.ID, "myDynamicElement"))
)
Or in your case:
element = WebDriverWait(driver, hours_to_wait *60*60).until(
EC.presence_of_element_located((By.CLASS_NAME, "modal-title"))
)
You need to import these:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC