ptit truc par ci par la

This commit is contained in:
piair 2022-11-06 13:29:55 +01:00
parent 545eea48cc
commit afec68a23e
1 changed files with 9 additions and 24 deletions

33
V4.py
View File

@ -185,11 +185,7 @@ def PlayQuiz8():
shuffle(isCorrect) shuffle(isCorrect)
for i in isCorrect: for i in isCorrect:
try : WaitUntilVisible(By.ID, i, to = 20, browser=driver)
WaitUntilVisible(By.ID, i, to = 20, browser=driver)
except Exception as e:
print(e)
print("wait")
c += 1 c += 1
progressBar(c, 16, name="Quiz 8 ") progressBar(c, 16, name="Quiz 8 ")
try: try:
@ -349,7 +345,6 @@ def AllCard(): # fonction qui clique sur les cartes
driver.refresh() driver.refresh()
""" """
login() tries to login to your micrososft account. login() tries to login to your micrososft account.
it uses global variable _mail and _password to login it uses global variable _mail and _password to login
@ -483,7 +478,7 @@ def TryPlay(nom="inconnu"):
RGPD() RGPD()
printf("TryPlay en cours") printf("TryPlay en cours")
def play(number, override=None): def play(number):
if number == 8 or number == 9: if number == 8 or number == 9:
try: try:
printf(f"\033[96m Quiz 8 détecté sur la page {nom} \033[0m") printf(f"\033[96m Quiz 8 détecté sur la page {nom} \033[0m")
@ -529,14 +524,7 @@ def TryPlay(nom="inconnu"):
elif "rqQuestionState" in driver.page_source: elif "rqQuestionState" in driver.page_source:
try: try:
number = driver.page_source.count("rqAnswerOption") number = driver.page_source.count("rqAnswerOption")
restant = len( printf(f"recovery détecté. quiz : {number}")
findall('"rqQuestionState.?." class=', driver.page_source)
) - len(
findall(
'"rqQuestionState.?." class="filledCircle"', driver.page_source
)
)
printf(f"recovery détecté. quiz : {number}, restant : {restant +1}")
play(number-1, override=restant + 1) play(number-1, override=restant + 1)
except Exception as e: except Exception as e:
printf("TryPlay - 2 - " + e) printf("TryPlay - 2 - " + e)
@ -627,13 +615,10 @@ def Fidelite():
if (lien.split(":")[0] == "https") or (lien.split(":")[0] == "http") : if (lien.split(":")[0] == "https") or (lien.split(":")[0] == "http") :
driver.get(lien) driver.get(lien)
CustomSleep(5)
try : WaitUntilVisible(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]', browser=driver)
choix = driver.find_element(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]') # pull-left spacer-48-bottom punchcard-row? USELESS ? choix = driver.find_element(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]') # pull-left spacer-48-bottom punchcard-row? USELESS ?
except :
CustomSleep(300)
choix = driver.find_element(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]') # pull-left spacer-48-bottom punchcard-row? USELESS ?
nb = search("([0-9]) of ([0-9]) completed", driver.page_source) nb = search("([0-9]) of ([0-9]) completed", driver.page_source)
if not nb: if not nb:
nb = search("([0-9]) de ([0-9]) finalisé", driver.page_source) nb = search("([0-9]) de ([0-9]) finalisé", driver.page_source)
@ -672,7 +657,7 @@ def Mlogin(echec):
try: try:
MobileDriver.get("https://www.bing.com/search?q=test+speed") MobileDriver.get("https://www.bing.com/search?q=test+speed")
MRGPD() MRGPD()
printf("début du login") printf("start of Mobile login")
MobileDriver.find_element(By.ID, "mHamburger").click() MobileDriver.find_element(By.ID, "mHamburger").click()
WaitUntilVisible(By.ID, "hb_s", browser=MobileDriver) WaitUntilVisible(By.ID, "hb_s", browser=MobileDriver)
MobileDriver.find_element(By.ID, "hb_s").click() MobileDriver.find_element(By.ID, "hb_s").click()
@ -691,7 +676,7 @@ def Mlogin(echec):
except Exception as e: except Exception as e:
pass pass
printf("fin du Mlogin") printf("end of Mobile login")
except Exception as e: except Exception as e:
echec += 1 echec += 1