Induce WebDriverWait and visibility_of_element_located() and following locator strategy.
Using CLASS_NAME
:
print(WebDriverWait(driver,20).until(EC.visibility_of_element_located((By.CLASS_NAME,"modal-content"))).text)
Using XPATH
:
print(WebDriverWait(driver,20).until(EC.visibility_of_element_located((By.XPATH,"//div[@class='modal-content' and @data-role='content']"))).text)
You need to import followings.
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
EDITED
Check the textContent
attribute value.
print(WebDriverWait(driver,20).until(EC.visibility_of_element_located((By.CLASS_NAME,"modal-content"))).get_attribute("textContent"))
OR
print(WebDriverWait(driver,20).until(EC.visibility_of_element_located((By.XPATH,"//div[@class='modal-content' and @data-role='content']"))).get_attribute("textContent"))