diff --git a/superset/utils/webdriver.py b/superset/utils/webdriver.py index 3e4705da6ee7e..6a334e1c5fcb8 100644 --- a/superset/utils/webdriver.py +++ b/superset/utils/webdriver.py @@ -379,11 +379,19 @@ def get_screenshot(self, url: str, element_name: str, user: User) -> bytes | Non ) ) except TimeoutException: - logger.exception( - "Selenium timed out waiting for chart containers to draw at url %s", - url, - ) - raise + # Fallback to allow a screenshot of an empty dashboard + try: + WebDriverWait(driver, 0).until( + EC.visibility_of_all_elements_located( + (By.CLASS_NAME, "grid-container") + ) + ) + except: + logger.exception( + "Selenium timed out waiting for dashboard to draw at url %s", + url, + ) + raise try: # charts took too long to load