Skip to content

Instantly share code, notes, and snippets.

@dshabin
Created October 20, 2017 23:35
Show Gist options
  • Save dshabin/ca398bdb9a3fa3b1eeb8c6d597d41b07 to your computer and use it in GitHub Desktop.
Save dshabin/ca398bdb9a3fa3b1eeb8c6d597d41b07 to your computer and use it in GitHub Desktop.
from selenium import webdriver
import time
import json
json_data=open("logos.json").read()
logos_dict = json.loads(json_data)
def finder(uuid):
name = ''
for logo in logos_dict :
if logo['uuid'] == uuid:
name = logo['name']
break
return name
driver = webdriver.Chrome()
url = "https://javascript-game.firebaseapp.com/#/"
driver.get(url)
while True:
source = driver.page_source
uuid = source.split('../static/logos/')[1][:36]
name = finder(uuid)
buttons = driver.find_elements_by_css_selector(".ripple-button")
for button in buttons :
print(button.text)
if name.upper() == str(button.text).upper() :
button.click()
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment