Skip to content

Instantly share code, notes, and snippets.

@aflaag
Last active May 25, 2019 07:31
Show Gist options
  • Save aflaag/cc0dd399ddcd34cbcba82e8709255d69 to your computer and use it in GitHub Desktop.
Save aflaag/cc0dd399ddcd34cbcba82e8709255d69 to your computer and use it in GitHub Desktop.
from selenium import webdriver
import urllib.request
import time
class Finder:
def __init__(self, url):
self.driver = webdriver.Chrome() # this could be editable but whatever
self.driver.get(url)
def find(self, id):
try:
return self.driver.find_element_by_id(id).text
except:
return None
def close(self):
self.driver.close()
def main():
finder = Finder("https://quickdraw.withgoogle.com")
while True:
clock = finder.find("clock-time")
if clock == "00:00":
urllib.request.urlopen("http://192.168.1.164:8080")
while True:
clock = finder.find("clock-time")
try:
seconds = int(clock[3:5])
if seconds > 15:
break
except:
break
else:
print(clock, end = "\r")
finder.close() # probably unreachable code
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment