mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-11-04 07:33:53 +01:00 
			
		
		
		
	uéuéué faster, more reliable, ...
This commit is contained in:
		
							
								
								
									
										147
									
								
								V5.py
									
									
									
									
									
								
							
							
						
						
									
										147
									
								
								V5.py
									
									
									
									
									
								
							@@ -137,7 +137,7 @@ def play_quiz8():
 | 
				
			|||||||
        counter = 0
 | 
					        counter = 0
 | 
				
			||||||
        # rgpd_popup(driver)
 | 
					        # rgpd_popup(driver)
 | 
				
			||||||
        for _ in range(override):  
 | 
					        for _ in range(override):  
 | 
				
			||||||
            custom_sleep(uniform(3, 5))
 | 
					            sleep(uniform(3, 5))
 | 
				
			||||||
            correct_answers = []
 | 
					            correct_answers = []
 | 
				
			||||||
            for i in range(1,9):
 | 
					            for i in range(1,9):
 | 
				
			||||||
                try : 
 | 
					                try : 
 | 
				
			||||||
@@ -154,10 +154,10 @@ def play_quiz8():
 | 
				
			|||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    answer_elem = driver.find_element(By.ID, answer_id)
 | 
					                    answer_elem = driver.find_element(By.ID, answer_id)
 | 
				
			||||||
                    answer_elem.click()
 | 
					                    answer_elem.click()
 | 
				
			||||||
                    custom_sleep(1)
 | 
					                    sleep(1)
 | 
				
			||||||
                except exceptions.NoSuchElementException :
 | 
					                except exceptions.NoSuchElementException :
 | 
				
			||||||
                    driver.refresh()
 | 
					                    driver.refresh()
 | 
				
			||||||
                    custom_sleep(10)
 | 
					                    sleep(10)
 | 
				
			||||||
                    answer_elem = driver.find_element(By.ID, answer_id)
 | 
					                    answer_elem = driver.find_element(By.ID, answer_id)
 | 
				
			||||||
                    answer_elem.click()
 | 
					                    answer_elem.click()
 | 
				
			||||||
                except ElementClickInterceptedException :
 | 
					                except ElementClickInterceptedException :
 | 
				
			||||||
@@ -252,19 +252,22 @@ def all_cards(): # return to the main page and closes all other tabs
 | 
				
			|||||||
                    reset()
 | 
					                    reset()
 | 
				
			||||||
                    printf(f"DailyCard {titre} ok")
 | 
					                    printf(f"DailyCard {titre} ok")
 | 
				
			||||||
                except Exception as e:
 | 
					                except Exception as e:
 | 
				
			||||||
                    log_error(f"all_cards card {titre} error ({format_error(e)})")
 | 
					                    log_error(f"all_cards card `{titre}` error ({format_error(e)})")
 | 
				
			||||||
                """
 | 
					                    break
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
                try : # devrait renvoyer vrai si la carte i est faite ou pas, a l'aide su symbole en haut a droite de la carte
 | 
					                try : # devrait renvoyer vrai si la carte i est faite ou pas, a l'aide su symbole en haut a droite de la carte
 | 
				
			||||||
                    elm = driver.find_element(By.XPATH, f"/html/body/div/div/div[3]/div[2]/div[1]/div[2]/div/div[{i+1}]/a/div/div[2]/div[1]/div[2]/div")
 | 
					                    elm = driver.find_elements(By.CLASS_NAME, 'promo_cont')[i]
 | 
				
			||||||
                    if not ("correctCircle" in elm.get_attribute("innerHTML")):
 | 
					                    if not ("correctCircle" in elm.get_attribute("innerHTML")):
 | 
				
			||||||
                        printf(f"missed card {i}")
 | 
					                        printf(f"missed card {i}")
 | 
				
			||||||
                        try_play(titre)
 | 
					                        elm.click()
 | 
				
			||||||
 | 
					                        try_play("recovery")
 | 
				
			||||||
                        sleep(3)
 | 
					                        sleep(3)
 | 
				
			||||||
                        reset()
 | 
					                        reset()
 | 
				
			||||||
 | 
					                    else :
 | 
				
			||||||
 | 
					                        printf(f'carte OK')
 | 
				
			||||||
                except Exception as e : 
 | 
					                except Exception as e : 
 | 
				
			||||||
                    printf(format_error(e) + "probablement ok - check card")
 | 
					                    printf(format_error(e) + "probablement ok - check card")
 | 
				
			||||||
                 # if it fail, it's probably okay -> when all three card are done, the pannel fold
 | 
					                 # if it fail, it's probably okay -> when all three card are done, the pannel fold
 | 
				
			||||||
                """
 | 
					 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            log_error(e)
 | 
					            log_error(e)
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@@ -276,82 +279,73 @@ def all_cards(): # return to the main page and closes all other tabs
 | 
				
			|||||||
            row_element.click()
 | 
					            row_element.click()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for i in range(20): # Should raise an error whene there is no card left
 | 
					        for i in range(20): # Should raise an error whene there is no card left
 | 
				
			||||||
            printf("début de l'une des cartes")
 | 
					 | 
				
			||||||
            elm = driver.find_elements(By.CLASS_NAME, 'promo_cont')
 | 
					            elm = driver.find_elements(By.CLASS_NAME, 'promo_cont')
 | 
				
			||||||
            try :
 | 
					            try :
 | 
				
			||||||
                elm[0].click()
 | 
					                elm[0].click()
 | 
				
			||||||
 | 
					                printf(f"Carte {i+1} cliquée.")
 | 
				
			||||||
            except Exception as e :
 | 
					            except Exception as e :
 | 
				
			||||||
                print(f"{e} + {driver.current_url}")
 | 
					                printf(f"Plus aucune carte.")
 | 
				
			||||||
                break
 | 
					                break
 | 
				
			||||||
            driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
 | 
					            driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
 | 
				
			||||||
            sleep(1)
 | 
					            sleep(1)
 | 
				
			||||||
            titre = driver.title
 | 
					            titre = driver.title.split(" - Recherche")[0]
 | 
				
			||||||
            printf(f"carte {titre} en cours")
 | 
					            printf(f"Carte `{titre}` en cours.")
 | 
				
			||||||
            try_play(titre)
 | 
					            try_play(titre)
 | 
				
			||||||
            reset(True)
 | 
					            reset(True)
 | 
				
			||||||
            sleep(1)
 | 
					            sleep(1)
 | 
				
			||||||
            #try:
 | 
					 | 
				
			||||||
            #    findall('href="([^<]+)" title=""', driver.page_source)[3]  # return error if there is no cards left to do
 | 
					 | 
				
			||||||
            #except:
 | 
					 | 
				
			||||||
            #    break
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def top_cards():
 | 
					    def top_cards():
 | 
				
			||||||
        for _ in range(2):
 | 
					        for _ in range(2):
 | 
				
			||||||
            try :
 | 
					            try :
 | 
				
			||||||
                driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div/div[1]/div[2]").click()
 | 
					                driver.find_elements(By.CSS_SELECTOR, '[class="banner_cont single wpoints"]')[0].click()
 | 
				
			||||||
                reset()
 | 
					                reset()
 | 
				
			||||||
            except Exception as e:
 | 
					            except Exception as e:
 | 
				
			||||||
                printf(format_error(e))
 | 
					                printf(format_error(e))
 | 
				
			||||||
                break
 | 
					                break
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    try :
 | 
					    try :
 | 
				
			||||||
        #top_cards()
 | 
					        top_cards()
 | 
				
			||||||
        print("top card not working really well right now. They are currently disabled")
 | 
					 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        log_error(e)
 | 
					        log_error(e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        daily_cards()
 | 
					        daily_cards()
 | 
				
			||||||
        print("daily card")
 | 
					 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        log_error(e)
 | 
					        log_error(e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try :
 | 
					    try :
 | 
				
			||||||
        weekly_cards()
 | 
					        weekly_cards()
 | 
				
			||||||
        print("weekly card")
 | 
					 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        log_error(e)
 | 
					        log_error(e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Find out which type of action to do
 | 
					# Find out which type of action to do
 | 
				
			||||||
def try_play(nom="inconnu"):
 | 
					def try_play(nom="inconnu"):
 | 
				
			||||||
    rgpd_popup(driver)
 | 
					    # rgpd_popup(driver)
 | 
				
			||||||
    printf("try_play en cours")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def play(number):
 | 
					    def play(number):
 | 
				
			||||||
        if number == 8 or number == 9:
 | 
					        if number == 8 or number == 9:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                printf(f"\033[96m Quiz 8 detected on {nom} \033[0m")
 | 
					                printf(f"\033[96mQuiz 8 detected on `{nom}` \033[0m")
 | 
				
			||||||
                play_quiz8()
 | 
					                play_quiz8()
 | 
				
			||||||
                printf(f"\033[92m Quiz 8 succeeded on {nom} \033[0m")
 | 
					                printf(f"\033[92mQuiz 8 succeeded on `{nom}` \033[0m")
 | 
				
			||||||
                custom_sleep(uniform(3, 5))
 | 
					                custom_sleep(uniform(3, 5))
 | 
				
			||||||
            except Exception as e:
 | 
					            except Exception as e:
 | 
				
			||||||
                printf(f"fail of PlayQuiz 8. Aborted {e} \033[0m")
 | 
					                printf(f"fail of PlayQuiz 8. Aborted {e} \033[0m")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        elif number == 5 or number == 4:
 | 
					        elif number == 5 or number == 4:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                printf(f"\033[96m Quiz 4 detected on {nom} \033[0m")
 | 
					                printf(f"\033[96mQuiz 4 detected on `{nom}` \033[0m")
 | 
				
			||||||
                play_quiz4()
 | 
					                play_quiz4()
 | 
				
			||||||
                printf(f"\033[92m Quiz 4 succeeded on {nom} \033[0m")
 | 
					                printf(f"\033[92mQuiz 4 succeeded on `{nom}` \033[0m")
 | 
				
			||||||
                custom_sleep(uniform(3, 5))
 | 
					                custom_sleep(uniform(3, 5))
 | 
				
			||||||
            except Exception as e:
 | 
					            except Exception as e:
 | 
				
			||||||
                printf(f"fail of PlayQuiz 4. Aborted {e} \033[0m")
 | 
					                printf(f"Fail of PlayQuiz 4. Aborted {e} \033[0m")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        elif number == 3 or number == 2:
 | 
					        elif number == 3 or number == 2:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                printf(f"\033[96m Quiz 2 detected on {nom}\033[0m")
 | 
					                printf(f"\033[96mQuiz 2 detected on `{nom}`\033[0m")
 | 
				
			||||||
                play_quiz2()
 | 
					                play_quiz2()
 | 
				
			||||||
                printf(f"\033[92m Quiz 2 succeeded on {nom}\033[0m")
 | 
					                printf(f"\033[92mQuiz 2 succeeded on `{nom}`\033[0m")
 | 
				
			||||||
            except Exception as e:
 | 
					            except Exception as e:
 | 
				
			||||||
                printf(f"fail of PlayQuiz 2. Aborted {e}")
 | 
					                printf(f"fail of PlayQuiz 2. Aborted {e}")
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
@@ -366,7 +360,6 @@ def try_play(nom="inconnu"):
 | 
				
			|||||||
        if "bt_PollRadio" in driver.page_source:
 | 
					        if "bt_PollRadio" in driver.page_source:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                printf("Poll detected")
 | 
					                printf("Poll detected")
 | 
				
			||||||
                #rgpd_popup(driver)
 | 
					 | 
				
			||||||
                do_poll()
 | 
					                do_poll()
 | 
				
			||||||
                printf("Poll succeeded")
 | 
					                printf("Poll succeeded")
 | 
				
			||||||
            except Exception as e:
 | 
					            except Exception as e:
 | 
				
			||||||
@@ -382,12 +375,10 @@ def try_play(nom="inconnu"):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        elif search("([0-9]) de ([0-9]) finalisée", driver.page_source):
 | 
					        elif search("([0-9]) de ([0-9]) finalisée", driver.page_source):
 | 
				
			||||||
            printf("fidélité")
 | 
					            printf("fidélité")
 | 
				
			||||||
            #rgpd_popup(driver)
 | 
					 | 
				
			||||||
            fidelity()
 | 
					            fidelity()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            printf(f"rien à faire sur la page {nom}")
 | 
					            printf(f"rien à faire sur la page {nom}")
 | 
				
			||||||
            # rgpd_popup(driver)
 | 
					 | 
				
			||||||
            custom_sleep(uniform(3, 5))
 | 
					            custom_sleep(uniform(3, 5))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -463,7 +454,6 @@ def login(ldriver):
 | 
				
			|||||||
            ldriver.refresh()
 | 
					            ldriver.refresh()
 | 
				
			||||||
        except WebDriverException as e: # This error occurs at random time. Don't really know why
 | 
					        except WebDriverException as e: # This error occurs at random time. Don't really know why
 | 
				
			||||||
            if "Reached error page: about:neterror?e=netTimeout" in str(e):
 | 
					            if "Reached error page: about:neterror?e=netTimeout" in str(e):
 | 
				
			||||||
                printf("Timeout error occurred. \"normal\"....., maybe because of mismatch date ? ")
 | 
					 | 
				
			||||||
                log_error("Timeout error occurred. \"normal\"....., maybe because of mismatch date ?", ldriver, True) # TODO check this hypothesis
 | 
					                log_error("Timeout error occurred. \"normal\"....., maybe because of mismatch date ?", ldriver, True) # TODO check this hypothesis
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                log_error(e, ldriver)
 | 
					                log_error(e, ldriver)
 | 
				
			||||||
@@ -510,6 +500,9 @@ def login(ldriver):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if ('account.live.com' in ldriver.current_url):
 | 
					        if ('account.live.com' in ldriver.current_url):
 | 
				
			||||||
            log_error("error 1", ldriver, True)
 | 
					            log_error("error 1", ldriver, True)
 | 
				
			||||||
 | 
					            if "Abuse" in ldriver.current_url:
 | 
				
			||||||
 | 
					                log_error("banned", ldriver)
 | 
				
			||||||
 | 
					                raise Banned()
 | 
				
			||||||
            ldriver.refresh()
 | 
					            ldriver.refresh()
 | 
				
			||||||
            log_error("error 2", ldriver, True)
 | 
					            log_error("error 2", ldriver, True)
 | 
				
			||||||
            ldriver.get("https://bing.com")
 | 
					            ldriver.get("https://bing.com")
 | 
				
			||||||
@@ -521,7 +514,6 @@ def login(ldriver):
 | 
				
			|||||||
            
 | 
					            
 | 
				
			||||||
        printf("cookies plus valides ?")
 | 
					        printf("cookies plus valides ?")
 | 
				
			||||||
        return(False)
 | 
					        return(False)
 | 
				
			||||||
 | 
					 | 
				
			||||||
    try : 
 | 
					    try : 
 | 
				
			||||||
        if cookie_login():
 | 
					        if cookie_login():
 | 
				
			||||||
            return (ldriver.current_window_handle)
 | 
					            return (ldriver.current_window_handle)
 | 
				
			||||||
@@ -607,23 +599,16 @@ def unban() -> None:
 | 
				
			|||||||
# Sends points to database, discord and whatever service you want
 | 
					# Sends points to database, discord and whatever service you want
 | 
				
			||||||
def log_points(account="unknown"): 
 | 
					def log_points(account="unknown"): 
 | 
				
			||||||
    def get_points():
 | 
					    def get_points():
 | 
				
			||||||
        driver.get("https://www.bing.com/rewardsapp/flyout")
 | 
					        driver.get("https://rewards.bing.com")
 | 
				
			||||||
        regex1 = '<a href="https://rewards\.bing\.com/" title="((.{1,3}),(.{1,3})) points" target="_blank"'
 | 
					        wait_until_visible(By.CSS_SELECTOR, 'span[mee-element-ready="$ctrl.loadCounterAnimation()"]', browser=driver)
 | 
				
			||||||
        try:
 | 
					 | 
				
			||||||
            point = search(regex1, driver.page_source)[1].replace(",", "")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        except Exception as e:
 | 
					 | 
				
			||||||
            elem = driver.find_element(By.CSS_SELECTOR, '[title="Microsoft Rewards"]')
 | 
					 | 
				
			||||||
            elem.click()
 | 
					 | 
				
			||||||
            custom_sleep(5)
 | 
					 | 
				
			||||||
            driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
 | 
					 | 
				
			||||||
            custom_sleep(uniform(5,7))
 | 
					 | 
				
			||||||
        try : 
 | 
					        try : 
 | 
				
			||||||
                point = search('availablePoints":([\d]+)', driver.page_source)[1]
 | 
					            point = search('availablePoints\":([\d]+)', driver.page_source)[1]
 | 
				
			||||||
            except :
 | 
					        except Exception as e:
 | 
				
			||||||
 | 
					            sleep(5)
 | 
				
			||||||
 | 
					            log_error(f"Dev error, checking why it doesn't work (waited a bit, is this still white ?) {format_error(e)}", driver, True)
 | 
				
			||||||
            driver.refresh()
 | 
					            driver.refresh()
 | 
				
			||||||
            sleep(5)
 | 
					            sleep(5)
 | 
				
			||||||
                point = search('availablePoints":([\d]+)', driver.page_source)[1]
 | 
					            point = search('availablePoints\":([\d]+)', driver.page_source)[1]
 | 
				
			||||||
        return(point)
 | 
					        return(point)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for _ in range (3):
 | 
					    for _ in range (3):
 | 
				
			||||||
@@ -677,7 +662,8 @@ def fidelity():
 | 
				
			|||||||
                try : 
 | 
					                try : 
 | 
				
			||||||
                    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 : # tentative de fix
 | 
					                except : # tentative de fix
 | 
				
			||||||
                    driver.refresh()
 | 
					                    driver.execute_script("location.reload(true);")
 | 
				
			||||||
 | 
					                    wait_until_visible(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"]')
 | 
					                    choix = driver.find_element(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]')
 | 
				
			||||||
                answer_number = search("([0-9]) of ([0-9]) completed", driver.page_source)
 | 
					                answer_number = search("([0-9]) of ([0-9]) completed", driver.page_source)
 | 
				
			||||||
                if answer_number is None:
 | 
					                if answer_number is None:
 | 
				
			||||||
@@ -719,60 +705,6 @@ def fidelity():
 | 
				
			|||||||
        log_error(e)
 | 
					        log_error(e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def mobile_login_pwd(error):
 | 
					 | 
				
			||||||
    try:
 | 
					 | 
				
			||||||
        # TODO 
 | 
					 | 
				
			||||||
        # seems fine, check if there are no issues NO
 | 
					 | 
				
			||||||
        mot = choice(Liste_de_mot).replace(" ","+")
 | 
					 | 
				
			||||||
        mobile_driver.get(f"https://www.bing.com/search?q={mot}")
 | 
					 | 
				
			||||||
        rgpd_popup(mobile_driver)
 | 
					 | 
				
			||||||
        printf("start of Mobile login")
 | 
					 | 
				
			||||||
        try :
 | 
					 | 
				
			||||||
            mobile_driver.find_element(By.ID, "mHamburger").click()
 | 
					 | 
				
			||||||
        except Exception as e :
 | 
					 | 
				
			||||||
            elm = mobile_driver.find_element(By.ID, "mHamburger") 
 | 
					 | 
				
			||||||
            mobile_driver.execute_script("arguments[0].scrollIntoView();", elm)
 | 
					 | 
				
			||||||
            mobile_driver.find_element(By.ID, "mHamburger").click()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        wait_until_visible(By.ID, "hb_s", browser=mobile_driver)
 | 
					 | 
				
			||||||
        mobile_driver.find_element(By.ID, "hb_s").click()
 | 
					 | 
				
			||||||
        wait_until_visible(By.ID, "i0116", browser=mobile_driver)
 | 
					 | 
				
			||||||
        mail_elem = mobile_driver.find_element(By.ID, "i0116")
 | 
					 | 
				
			||||||
        send_keys_wait(mail_elem, _mail)
 | 
					 | 
				
			||||||
        mail_elem.send_keys(Keys.ENTER)
 | 
					 | 
				
			||||||
        wait_until_visible(By.ID, "i0118", browser=mobile_driver)
 | 
					 | 
				
			||||||
        pwd_elem = mobile_driver.find_element(By.ID, "i0118")
 | 
					 | 
				
			||||||
        send_keys_wait(pwd_elem, _password)
 | 
					 | 
				
			||||||
        pwd_elem.send_keys(Keys.ENTER)
 | 
					 | 
				
			||||||
        custom_sleep(uniform(1, 2))
 | 
					 | 
				
			||||||
        if "Entrez le code de sécurité" in driver.page_source :
 | 
					 | 
				
			||||||
            try : 
 | 
					 | 
				
			||||||
                a2f_elem = mobile_driver.find_element(By.ID, "idTxtBx_SAOTCC_OTC")
 | 
					 | 
				
			||||||
                a2f_elem.send_keys(_otp.now())
 | 
					 | 
				
			||||||
                a2f_elem.send_keys(Keys.ENTER)
 | 
					 | 
				
			||||||
            except Exception as e :
 | 
					 | 
				
			||||||
                log_error(e)
 | 
					 | 
				
			||||||
        custom_sleep(uniform(1, 2))        
 | 
					 | 
				
			||||||
        for i in ["KmsiCheckboxField", "iLooksGood", "idSIButton9"]:
 | 
					 | 
				
			||||||
            try:
 | 
					 | 
				
			||||||
                mobile_driver.find_element(By.ID,i ).click()
 | 
					 | 
				
			||||||
            except Exception as e:
 | 
					 | 
				
			||||||
                pass
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        printf("end of Mobile login")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    except Exception as e:
 | 
					 | 
				
			||||||
        error += 1
 | 
					 | 
				
			||||||
        if error <= 3:
 | 
					 | 
				
			||||||
            printf(f"failure on mobile_login. Retrying({error}/3), {e}")
 | 
					 | 
				
			||||||
            custom_sleep(uniform(5, 10))
 | 
					 | 
				
			||||||
            mobile_login_pwd(error)
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            log_error(f"login impossible 3 fois de suite. {e}", mobile_driver)
 | 
					 | 
				
			||||||
            mobile_driver.quit()
 | 
					 | 
				
			||||||
            return(True)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def mobile_alert_popup():
 | 
					def mobile_alert_popup():
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        alert = mobile_driver.switch_to.alert
 | 
					        alert = mobile_driver.switch_to.alert
 | 
				
			||||||
@@ -910,7 +842,6 @@ def CustomStart(Credentials):
 | 
				
			|||||||
            driver.close()
 | 
					            driver.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
if VNC_ENABLED : 
 | 
					if VNC_ENABLED : 
 | 
				
			||||||
    display = SmartDisplay(backend="xvnc", size=(2160, 2160), rfbport=VNC_PORT, color_depth=24) 
 | 
					    display = SmartDisplay(backend="xvnc", size=(2160, 2160), rfbport=VNC_PORT, color_depth=24) 
 | 
				
			||||||
else :
 | 
					else :
 | 
				
			||||||
@@ -943,9 +874,9 @@ else:
 | 
				
			|||||||
        printf("\n\n")
 | 
					        printf("\n\n")
 | 
				
			||||||
        printf(_mail)
 | 
					        printf(_mail)
 | 
				
			||||||
        custom_sleep(1)
 | 
					        custom_sleep(1)
 | 
				
			||||||
        printf("début du driver")
 | 
					        printf("Début du driver.")
 | 
				
			||||||
        driver = firefox_driver()
 | 
					        driver = firefox_driver()
 | 
				
			||||||
        printf("driver demarré")
 | 
					        printf("Driver demarré.")
 | 
				
			||||||
        driver.implicitly_wait(3)
 | 
					        driver.implicitly_wait(3)
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            daily_routine()
 | 
					            daily_routine()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ from modules.config import *
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# add the time arround the text given in [text]&
 | 
					# add the time arround the text given in [text]&
 | 
				
			||||||
def Timer(text: str, mail: str) -> str:
 | 
					def Timer(text: str, mail: str) -> str:
 | 
				
			||||||
    return(f"[{mail} - {datetime.today().strftime('%d-%m-%Y')} - {timedelta(seconds = round(float(time() - START_TIME)))}] " + str(text))
 | 
					    return(f"[{mail.split('@')[0]} - {datetime.today().strftime('%d/%m')} - {timedelta(seconds = round(float(time() - START_TIME)))}] " + str(text))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# replace the function print, with more options
 | 
					# replace the function print, with more options
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user