Capture all sensor graphs
This commit is contained in:
parent
29ac0345c6
commit
08b7196c26
|
@ -3,17 +3,37 @@ import time
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.chrome.options import Options
|
from selenium.webdriver.chrome.options import Options
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
|
from selenium.webdriver.chrome.service import Service
|
||||||
|
from webdriver_manager.chrome import ChromeDriverManager
|
||||||
|
|
||||||
|
ser = Service('/usr/lib/chromium-browser/chromedriver')
|
||||||
chrome_options = Options()
|
chrome_options = Options()
|
||||||
chrome_options.add_argument('--headless')
|
chrome_options.add_argument('--headless')
|
||||||
chrome_options.add_argument('--no-sandbox')
|
chrome_options.add_argument('--no-sandbox')
|
||||||
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', options=chrome_options)
|
driver = webdriver.Chrome(service=ser, options=chrome_options)
|
||||||
driver.get('https://sensors.dns.t0.vc')
|
driver.get('https://sensors.dns.t0.vc')
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
element = driver.find_element(By.ID, 'Solar_Power')
|
graphs = [
|
||||||
|
'Solar_Power',
|
||||||
|
'Living_Room_Air',
|
||||||
|
'Outside_Temperature',
|
||||||
|
'Bedroom_Temperature',
|
||||||
|
'Nook_Temperature',
|
||||||
|
'Misc_Temperature',
|
||||||
|
'Nook_Thermostat',
|
||||||
|
'Gas_Usage',
|
||||||
|
'Water_Usage',
|
||||||
|
'Living_Room_Lux',
|
||||||
|
]
|
||||||
|
|
||||||
with open('image.png', 'wb') as f:
|
for graph in graphs:
|
||||||
f.write(element.screenshot_as_png)
|
print('Capturing', graph, 'graph...')
|
||||||
|
element = driver.find_element(By.ID, graph)
|
||||||
|
|
||||||
|
with open('data/{}.png'.format(graph), 'wb') as f:
|
||||||
|
f.write(element.screenshot_as_png)
|
||||||
|
|
||||||
driver.close()
|
driver.close()
|
||||||
|
print('done.')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user