-
Notifications
You must be signed in to change notification settings - Fork 1
/
10_fast.py
41 lines (30 loc) · 904 Bytes
/
10_fast.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Firefox()
def wait(no):
""" Waits for a particular time """
time.sleep(no)
def open_website():
""" Opens the website """
driver.get('https://10fastfingers.com/typing-test/english')
wait(5) # Due to slow network speed
def run_hack():
""" Implement the GOD speed hack """
open_website()
input_field = driver.find_element_by_id('inputfield')
try :
i = 0
while True:
elements = driver.find_element_by_xpath("//span[@wordnr='" + str(i) + "']")
print(elements.text)
input_field.send_keys(elements.text)
input_field.send_keys(" ")
i += 1
except :
print("Words completed")
def main():
""" Driver function """
run_hack()
if __name__ == '__main__':
main()