-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRunsAllScripts.py
More file actions
54 lines (51 loc) · 1.53 KB
/
RunsAllScripts.py
File metadata and controls
54 lines (51 loc) · 1.53 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
import OpenBrowser
import Racing
from OpenBrowser import driver
from time import sleep
while True:#To input the typing speed
try:
speed=int(input("Enter the typing speed(in WPM): "))
if speed<=0:
print("Speed cannot be negative.\nTry Again.")
else:
break
except ValueError:
print("You cannot enter a character at this input field.\nTry Again.")
sleeptime=60/(speed*6)
def RaceAsGuest(driver):
try:
driver.find_element_by_xpath('//*[text()="Race as a Guest"]').click() #Race as Guest
except:
try:
driver.find_element_by_css_selector('.tooltip').click() #Race as Guest
except:
pass
sleep(3)
def RaceAgain(driver):
try:
driver.find_element_by_css_selector('.btn--gloss').click()#clicks on the Race Again button
except:
try:
driver.find_element_by_xpath('//button[text()="Race Again"]').click()
except:
pass
OpenBrowser.Opening_Browser()
RaceAsGuest(driver)
Racing.Race(driver,sleeptime)
sleep(5)
while True:
try:
n=int(input("Enter the number of times you want the bot to perform: "))
if n<=0:
print("You cannot {} as the value of n".format(n))
else:
break
except ValueError:
print("You cannot enter a character at this input field.\nTry Again.")
RaceAsGuest(driver)
for cnt in range(n):
Racing.Race(driver,sleeptime)
sleep(15)
if cnt!=(n-1):
RaceAgain(driver)
print("The program has successfully ended.")