From 6224ed514df4513085c1aff7b6860c5aa2118fac Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Fri, 22 Feb 2019 11:20:01 +1100 Subject: [PATCH] Handle errors where GW level ( m AHD) is not available --- waternsw_grabber/waternsw_grabber.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/waternsw_grabber/waternsw_grabber.py b/waternsw_grabber/waternsw_grabber.py index 6bba141..f1e5f81 100644 --- a/waternsw_grabber/waternsw_grabber.py +++ b/waternsw_grabber/waternsw_grabber.py @@ -143,10 +143,13 @@ def get_telemetered_bore(driver, bore_id, start_date, end_date): interval.select_by_visible_text('All points') # Make sure 'Groundwater Level - AHD' is selected as an output - checkbox = driver.find_element_by_xpath( - '//*/input[contains(@name, "sel__110.00_115.00")]') - if not checkbox.get_attribute('selected'): - checkbox.click() + try: + checkbox = driver.find_element_by_xpath( + '//*/input[contains(@name, "sel__110.00_115.00")]') + if not checkbox.get_attribute('selected'): + checkbox.click() + except NoSuchElementException: + pass # Download data driver.execute_script("get_output()")