This commit is contained in:
piair 2021-12-23 17:55:04 +01:00
parent 06da57f457
commit bf8e584a83
1 changed files with 19 additions and 11 deletions

30
V4.py
View File

@ -221,10 +221,15 @@ def PlayQuiz8(override = None):
sleep(uniform(3,5)) sleep(uniform(3,5))
ListeOfGood =[] ListeOfGood =[]
for i in range(1,9): for i in range(1,9):
Card= driver.find_element_by_id(f'rqAnswerOption{i-1}') try :
if 'iscorrectoption="True" 'in Card.get_attribute('outerHTML') : Card= driver.find_element_by_id(f'rqAnswerOption{i-1}')
ListeOfGood.append(f'rqAnswerOption{i-1}') #premier div = 3 ? if 'iscorrectoption="True" 'in Card.get_attribute('outerHTML') :
ListeOfGood.append(f'rqAnswerOption{i-1}') #premier div = 3 ?
except Exception as e :
if override :
printf(e)
else :
LogError(e)
shuffle(ListeOfGood) shuffle(ListeOfGood)
for i in ListeOfGood : for i in ListeOfGood :
@ -546,14 +551,14 @@ def TryPlay(nom ="inconnu"):
RGPD() RGPD()
def play(number, override = None) : def play(number, override = None) :
match number : match number :
case 9 : case 9 | 8 :
try : try :
print(f'Quiz 8 détécté sur la page {nom}') print(f'Quiz 8 détécté sur la page {nom}')
RGPD() RGPD()
PlayQuiz8(override) PlayQuiz8(override)
except Exception as e : except Exception as e :
printf(f'echec de PlayQuiz 8. Aborted {e}') printf(f'echec de PlayQuiz 8. Aborted {e}')
case 5 : case 5 | 4 :
try : try :
print(f'Quiz 4 détécté sur la page {nom}') print(f'Quiz 4 détécté sur la page {nom}')
RGPD() RGPD()
@ -561,7 +566,7 @@ def TryPlay(nom ="inconnu"):
print('Quiz 4 reussit') print('Quiz 4 reussit')
except Exception as e : except Exception as e :
printf(f'echec de PlayQuiz 4. Aborted {e}') printf(f'echec de PlayQuiz 4. Aborted {e}')
case 3 : case 3 | 2 :
try : try :
RGPD() RGPD()
print(f'Quiz 2 détécté sur la page {nom}') print(f'Quiz 2 détécté sur la page {nom}')
@ -587,10 +592,13 @@ def TryPlay(nom ="inconnu"):
printf(f'Poll aborted {e}') printf(f'Poll aborted {e}')
elif "rqQuestionState" in driver.page_source : elif "rqQuestionState" in driver.page_source :
printf("recovery détécté") try :
number = driver.page_source.count('rqAnswerOption') number = driver.page_source.count('rqAnswerOption')
restant = len(findall("\"rqQuestionState.?.\" class=", driver.page_source)) - len(findall("\"rqQuestionState.?.\" class=\"filledCircle\"", driver.page_source)) restant = len(findall("\"rqQuestionState.?.\" class=", driver.page_source)) - len(findall("\"rqQuestionState.?.\" class=\"filledCircle\"", driver.page_source))
play(number, override=restant + 1 ) printf(f"recovery détécté. quiz : {number}, restant : {restant +1}")
play(number, override=restant + 1 )
except Exception as e :
printf(e)
elif search("([0-9]) de ([0-9]) finalisée",driver.page_source) : elif search("([0-9]) de ([0-9]) finalisée",driver.page_source) :
print('fidélité') print('fidélité')