Skip to content

Commit 9a43771

Browse files
authored
Add failsafe for missing answer + add captcha check to user login
1 parent 6b67961 commit 9a43771

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Source/QuizScript.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ def importCaptchaSolver():
1111
print("lite version, captcha solver not included")
1212
return None
1313

14-
importCaptchaSolver()
15-
1614
try:
1715
options = ChromiumOptions()
1816
options.set_argument("--profile-directory=Default")
@@ -48,6 +46,8 @@ def getCorrectAnswerBox(page, quizName):
4846
return
4947
else:
5048
answerCount += 1
49+
page.eles(".largecheckbox")[1].click() # if correct answer isn't found, just pick the first option to avoid hanging
50+
page.ele("#nextQuestion").click()
5151
return
5252

5353

@@ -62,6 +62,10 @@ def getCorrectAnswerBox(page, quizName):
6262

6363
time.sleep(0.25)
6464
driver.ele(".override width100").click()
65+
CaptchaSolver = importCaptchaSolver()
66+
if CaptchaSolver:
67+
statusText.set("Solving Captcha")
68+
CaptchaSolver.SolveWizCaptcha(driver)
6569

6670
time.sleep(1)
6771
statusText.set("Starting quizzes...")
@@ -101,6 +105,7 @@ def getCorrectAnswerBox(page, quizName):
101105
if CaptchaSolver:
102106
statusText.set("Solving Captcha")
103107
CaptchaSolver.SolveWizCaptcha(driver)
108+
time.sleep(1)
104109
creditsEarnedInSession.set(creditsEarnedInSession.get()+10)
105110
statusText.set("Results confirmed!")
106111
print("Quiz " + str(count) + " done.")

0 commit comments

Comments
 (0)