Use Firefox, and specify download location

master
Dan Howe 6 years ago
parent c94739a34f
commit ba6782d85a

@ -115,13 +115,23 @@ def get_telemetered_bore(driver, bore_id, start_date, end_date):
webdriver.ActionChains(driver).send_keys(Keys.ESCAPE).perform()
def open_browser():
def open_browser(download_dir):
# Warn if user does not have admin privileges
if not has_admin():
warnings.warn('This program should be run as an administrator.')
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2)
profile.set_preference('browser.download.manager.showWhenStarting', False)
profile.set_preference('browser.download.dir', download_dir)
profile.set_preference('browser.helperApps.neverAsk.saveToDisk',
('application/zip,'
'application/octet-stream,'
'application/x-zip-compressed,'
'multipart/x-zip'))
# Open browser
driver = webdriver.Chrome()
driver = webdriver.Firefox(firefox_profile=profile)
url = 'https://realtimedata.waternsw.com.au/water.stm'
driver.get(url)
@ -147,6 +157,3 @@ def main():
get_telemetered_bore(driver, bore_id, start_date, end_date)
driver.quit()
main()

Loading…
Cancel
Save