diff --git a/waternsw_grabber/waternsw_grabber.py b/waternsw_grabber/waternsw_grabber.py index bd89910..996d922 100644 --- a/waternsw_grabber/waternsw_grabber.py +++ b/waternsw_grabber/waternsw_grabber.py @@ -40,11 +40,19 @@ def has_admin(): def wait_for_element(driver, by, x, timeout=60): - try: - element_present = EC.presence_of_element_located((by, x)) - WebDriverWait(driver, timeout).until(element_present) - except TimeoutException: - print("Timed out waiting for page to load") + """Wait for element on page to load. + + Args: + driver: selenium webdriver object + by: locator strategy (e.g. By.ID) + x: locator string + timeout: maximum wait time (seconds) + + Raises + TimeoutException if element does not load within timeout period + """ + element_present = EC.presence_of_element_located((by, x)) + WebDriverWait(driver, timeout).until(element_present) def get_telemetered_bore(driver, bore_id, start_date, end_date):