From ad131de6b1d7d5b4794e0a61e0574d0d7bb4b858 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Thu, 21 Feb 2019 16:32:15 +1100 Subject: [PATCH] Use consistent function for waits --- waternsw_grabber/waternsw_grabber.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/waternsw_grabber/waternsw_grabber.py b/waternsw_grabber/waternsw_grabber.py index 10ce8dc..b76bff7 100644 --- a/waternsw_grabber/waternsw_grabber.py +++ b/waternsw_grabber/waternsw_grabber.py @@ -74,9 +74,8 @@ def get_telemetered_bore(driver, bore_id, start_date, end_date): driver.execute_script("go('{}','gw', 1)".format(bore_id)) # Wait for results frame to load - WebDriverWait( - driver, timeout=60).until( - EC.frame_to_be_available_and_switch_to_it('gwgwlf_org')) + wait_for_element(driver, By.ID, 'gwgwlf_org') + driver.switch_to.frame('gwgwlf_org') # Wait until body text of iframe has loaded body_text = None @@ -98,11 +97,10 @@ def get_telemetered_bore(driver, bore_id, start_date, end_date): wait_for_element(driver, By.XPATH, '//*[@id="tabstext"]') # Activate outputs tab, and wait for 'Get Output' button - driver.execute_script("menuloc.display_frame('gw','gwcf_org','1')") + driver.execute_script(menuloc.display_frame('gw','gwcf_org','1')) driver.switch_to.parent_frame() - WebDriverWait( - driver, timeout=60).until( - EC.frame_to_be_available_and_switch_to_it('gwgwcf_org')) + wait_for_element(driver, By.ID, 'gwgwcf_org') + driver.switch_to.frame('gwgwcf_org') wait_for_element(driver, By.ID, 'submit') # Get output select controls