Last active
September 23, 2020 19:41
-
-
Save PrateekKumarSingh/d11964768a6afc57e1f2ce0014ef9876 to your computer and use it in GitHub Desktop.
This file contains 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 | |
from selenium.webdriver.chrome.options import Options | |
url = "https://keytodatascience.com/games" | |
browser = webdriver.Chrome() | |
def capture_matrix(): | |
h = {} | |
for i in range(0,25): | |
element = browser.find_element_by_id(i) | |
h[int(element.text)] = element | |
return h | |
def click_matrix_buttons(dictionary,start_idx,count): | |
for i in range(start_idx,count): | |
dictionary[i].click() | |
print('Loading the URL...') | |
browser.get(url) | |
print('Game Started!') | |
browser.find_element_by_id('btnRestart').click() | |
print('Playing...') | |
click_matrix_buttons(capture_matrix(),1,26) | |
click_matrix_buttons(capture_matrix(),26,51) | |
print('Done!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment