mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
chore: log different selenium timeout errors differently (#23290)
This commit is contained in:
parent
57db8f938b
commit
989fe27a0f
@ -176,22 +176,46 @@ class WebDriverProxy:
|
|||||||
sleep(selenium_headstart)
|
sleep(selenium_headstart)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logger.debug("Wait for the presence of %s", element_name)
|
try:
|
||||||
element = WebDriverWait(driver, self._screenshot_locate_wait).until(
|
# page didn't load
|
||||||
EC.presence_of_element_located((By.CLASS_NAME, element_name))
|
logger.debug(
|
||||||
)
|
"Wait for the presence of %s at url: %s", element_name, url
|
||||||
|
|
||||||
logger.debug("Wait for chart containers to draw")
|
|
||||||
WebDriverWait(driver, self._screenshot_locate_wait).until(
|
|
||||||
EC.visibility_of_all_elements_located(
|
|
||||||
(By.CLASS_NAME, "slice_container")
|
|
||||||
)
|
)
|
||||||
)
|
element = WebDriverWait(driver, self._screenshot_locate_wait).until(
|
||||||
|
EC.presence_of_element_located((By.CLASS_NAME, element_name))
|
||||||
|
)
|
||||||
|
except TimeoutException as ex:
|
||||||
|
logger.exception("Selenium timed out requesting url %s", url)
|
||||||
|
raise ex
|
||||||
|
|
||||||
logger.debug("Wait for loading element of charts to be gone")
|
try:
|
||||||
WebDriverWait(driver, self._screenshot_load_wait).until_not(
|
# chart containers didn't render
|
||||||
EC.presence_of_all_elements_located((By.CLASS_NAME, "loading"))
|
logger.debug("Wait for chart containers to draw at url: %s", url)
|
||||||
)
|
WebDriverWait(driver, self._screenshot_locate_wait).until(
|
||||||
|
EC.visibility_of_all_elements_located(
|
||||||
|
(By.CLASS_NAME, "slice_container")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except TimeoutException as ex:
|
||||||
|
logger.exception(
|
||||||
|
"Selenium timed out waiting for chart containers to draw at url %s",
|
||||||
|
url,
|
||||||
|
)
|
||||||
|
raise ex
|
||||||
|
|
||||||
|
try:
|
||||||
|
# charts took too long to load
|
||||||
|
logger.debug(
|
||||||
|
"Wait for loading element of charts to be gone at url: %s", url
|
||||||
|
)
|
||||||
|
WebDriverWait(driver, self._screenshot_load_wait).until_not(
|
||||||
|
EC.presence_of_all_elements_located((By.CLASS_NAME, "loading"))
|
||||||
|
)
|
||||||
|
except TimeoutException as ex:
|
||||||
|
logger.exception(
|
||||||
|
"Selenium timed out waiting for charts to load at url %s", url
|
||||||
|
)
|
||||||
|
raise ex
|
||||||
|
|
||||||
selenium_animation_wait = current_app.config[
|
selenium_animation_wait = current_app.config[
|
||||||
"SCREENSHOT_SELENIUM_ANIMATION_WAIT"
|
"SCREENSHOT_SELENIUM_ANIMATION_WAIT"
|
||||||
@ -215,9 +239,9 @@ class WebDriverProxy:
|
|||||||
)
|
)
|
||||||
|
|
||||||
img = element.screenshot_as_png
|
img = element.screenshot_as_png
|
||||||
|
|
||||||
except TimeoutException:
|
except TimeoutException:
|
||||||
logger.exception("Selenium timed out requesting url %s", url)
|
# raise again for the finally block, but handled above
|
||||||
|
pass
|
||||||
except StaleElementReferenceException:
|
except StaleElementReferenceException:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
"Selenium got a stale element while requesting url %s",
|
"Selenium got a stale element while requesting url %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user