Created
October 20, 2017 23:35
-
-
Save dshabin/ca398bdb9a3fa3b1eeb8c6d597d41b07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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