Browser-Scripts/dino.py

20 lines
559 B
Python

import time
import pyautogui
import webbrowser
# Open Chrome
chrome_path = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
webbrowser.register('chrome', None, webbrowser.BackgroundBrowser(chrome_path))
webbrowser.get('chrome').open("http://google.com") # This opens Chrome to a default page
# Give it a few seconds to load
time.sleep(1)
# Focus on the address bar
pyautogui.hotkey('ctrl', 'l')
# Type the URL for the Dinosaur game
pyautogui.typewrite('chrome://dino', interval=0.02)
# Press Enter
pyautogui.press('enter')