This commit is contained in:
Jan-Henrik 2023-02-07 21:21:07 +01:00
parent c001ea4bcb
commit 8d932e849f
2 changed files with 3 additions and 2 deletions

View file

@ -1,6 +1,6 @@
---
name: Screenshotter
version: 1.0.1
version: 1.0.1.1
#image: ghcr.io/maxwinterstein/homeassistant-addon-toogoodtogo-ha-mqtt-bridge-{arch}
slug: screenshotter
description: Screenshot images for E-Paper pricetags

View file

@ -41,11 +41,12 @@ while True:
for task in tasks:
if task["next_execution"] > now:
continue
print(f"Running {task['name']}")
driver = webdriver.Chrome(options=chrome_options, desired_capabilities=d)
driver.implicitly_wait(10)
driver.get(task["url"])
# pause 3 second to let page loads
time.sleep(wait)
time.sleep(int(wait))
# save screenshot
file_name = f'/tmp/{task["name"]}.png'
driver.save_screenshot(file_name)