From 402b8cd3ef941846976f2de242f528dc2f3b6c85 Mon Sep 17 00:00:00 2001 From: augustin64 Date: Sun, 12 May 2024 17:55:56 +0200 Subject: [PATCH 1/3] Close streak protection --- V6.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/V6.py b/V6.py index f552bc8..87cb17d 100755 --- a/V6.py +++ b/V6.py @@ -220,6 +220,19 @@ 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_close.click() + custom_sleep(1.5) + + return True + except exceptions.NoSuchElementException: + return False + driver.get("https://rewards.bing.com") wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver) @@ -274,6 +287,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 +305,7 @@ def all_cards(): continue check_welcome_tour() + check_streak_protection() driver.execute_script("arguments[0].scrollIntoView();", card_list[i]) card_list[i].click() From 778adc67d2cac81bc65a5a9d143a7dceb9cdd59b Mon Sep 17 00:00:00 2001 From: augustin64 Date: Sun, 12 May 2024 18:07:36 +0200 Subject: [PATCH 2/3] Et si on l'active ? --- V6.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/V6.py b/V6.py index 87cb17d..d8ae0cb 100755 --- a/V6.py +++ b/V6.py @@ -226,11 +226,13 @@ def all_cards(): """ try: streak_protection_close = driver.find_element(By.ID, "streak-protection-popup-close-cross") - streak_protection_close.click() + 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: + except (exceptions.NoSuchElementException, IndexError): return False driver.get("https://rewards.bing.com") From 906d3e7822d3224aa35eae980da6c898e6a72f5f Mon Sep 17 00:00:00 2001 From: augustin64 Date: Sun, 12 May 2024 18:16:24 +0200 Subject: [PATCH 3/3] catch another exception --- V6.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/V6.py b/V6.py index d8ae0cb..9563f6c 100755 --- a/V6.py +++ b/V6.py @@ -232,7 +232,8 @@ def all_cards(): custom_sleep(1.5) return True - except (exceptions.NoSuchElementException, IndexError): + 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")