Skip to content

Instantly share code, notes, and snippets.

@patrickelectric
Last active December 11, 2023 11:26
Show Gist options
  • Save patrickelectric/a6b7c1d9393d04ac572452478ff9c8b5 to your computer and use it in GitHub Desktop.
Save patrickelectric/a6b7c1d9393d04ac572452478ff9c8b5 to your computer and use it in GitHub Desktop.
blueos screenshots pages
from selenium import webdriver
from PIL import Image
import time
from imageio import imwrite
url = "http://blueos-avahi.local"
paths = [
'/',
'/vehicle/autopilot',
'/vehicle/Setup',
'/vehicle/pings',
'/vehicle/logs',
'/vehicle/endpoints',
'/tools/file-browser',
'/tools/web-terminal',
'/tools/version-chooser',
'/vehicle/video-manager',
'/tools/bridges',
'/tools/nmea-injector',
'/tools/available-services',
'/tools/system-information',
'/tools/mavlink-inspector',
'/tools/network-test',
'/tools/bag-editor',
'/extensions/:port',
'/extension/:name/*',
'/extension/:name',
'/tools/extensions-manager',
'/vehicle/parameters',
]
driver = webdriver.Chrome()
def capture_screenshot(path):
filename = path.replace('/', '_').strip('_') + ".png"
driver.get(url + path)
time.sleep(10)
driver.save_screenshot(filename)
return filename
filenames = []
for path in paths:
try:
filenames.append(capture_screenshot(path))
except Exception as e:
print(f"Error capturing {path}: {e}")
driver.quit()
images = [Image.open(filename) for filename in filenames]
output_filename = "animation.gif"
imageio.mimsave(output_filename, images, format='GIF', duration=0.2)
print("Screenshots captured and GIF created successfully!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment