Compare commits

...

5 Commits

Author SHA1 Message Date
augustin64 6995bde8a6 Actualiser version 2024-05-12 18:55:51 +02:00
augustin64 92069a013e Merge pull request 'Handle Streak-Protection Popup' (#12) from streak-protection into master
Reviewed-on: https://gitea.augustin64.fr/piair/MsRewards-Reborn/pulls/12
2024-05-12 18:55:34 +02:00
augustin64 906d3e7822 catch another exception 2024-05-12 18:16:24 +02:00
augustin64 778adc67d2 Et si on l'active ? 2024-05-12 18:07:36 +02:00
augustin64 402b8cd3ef Close streak protection 2024-05-12 17:55:56 +02:00
2 changed files with 19 additions and 1 deletions

18
V6.py
View File

@ -220,6 +220,22 @@ def all_cards():
custom_sleep(1.5)
return True
def check_streak_protection() -> bool:
"""
Ne perdez plus jamais votre série !
"""
try:
streak_protection_close = driver.find_element(By.ID, "streak-protection-popup-close-cross")
streak_protection_activate = driver.find_elements(By.CLASS_NAME, "earningPagePopUpPopUpSelectButton")
streak_protection_activate[0].click()
info("Popup 'Streak Protection' reçue")
custom_sleep(1.5)
return True
except (exceptions.NoSuchElementException, exceptions.ElementNotInteractableException, IndexError):
# les éléments sont présents dans le DOM même quand la popup n'est pas visible apparemment
return False
driver.get("https://rewards.bing.com")
wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver)
@ -274,6 +290,7 @@ def all_cards():
custom_sleep(1.5)
check_welcome_tour()
check_streak_protection()
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
custom_sleep(1.5)
card_list[i].click()
@ -291,6 +308,7 @@ def all_cards():
continue
check_welcome_tour()
check_streak_protection()
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
card_list[i].click()

View File

@ -1 +1 @@
v6.8.52
v6.8.53