Wrap export in try: finally:
This commit is contained in:
parent
c693d30394
commit
1d5f63f86d
|
@ -12,7 +12,10 @@ chrome_options = Options()
|
||||||
chrome_options.add_argument('--headless')
|
chrome_options.add_argument('--headless')
|
||||||
chrome_options.add_argument('start-maximized')
|
chrome_options.add_argument('start-maximized')
|
||||||
chrome_options.add_argument('--no-sandbox')
|
chrome_options.add_argument('--no-sandbox')
|
||||||
|
|
||||||
driver = webdriver.Chrome(service=ser, options=chrome_options)
|
driver = webdriver.Chrome(service=ser, options=chrome_options)
|
||||||
|
|
||||||
|
try:
|
||||||
driver.get('https://sensors.dns.t0.vc')
|
driver.get('https://sensors.dns.t0.vc')
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
|
@ -45,6 +48,9 @@ for graph in graphs:
|
||||||
with open('/home/tanner/sensors/export/data/{}.png'.format(graph), 'wb') as f:
|
with open('/home/tanner/sensors/export/data/{}.png'.format(graph), 'wb') as f:
|
||||||
f.write(element.screenshot_as_png)
|
f.write(element.screenshot_as_png)
|
||||||
|
|
||||||
|
finally:
|
||||||
driver.close()
|
driver.close()
|
||||||
|
driver.quit()
|
||||||
|
|
||||||
print('done.')
|
print('done.')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user