Check if streak protection expired
This commit is contained in:
parent
df256f2405
commit
c53125479e
31
V6.py
31
V6.py
@ -200,6 +200,10 @@ def do_poll():
|
|||||||
def all_cards():
|
def all_cards():
|
||||||
driver = config.WebDriver.driver
|
driver = config.WebDriver.driver
|
||||||
|
|
||||||
|
def check_popups() -> bool:
|
||||||
|
"""
|
||||||
|
Check various annoying popups
|
||||||
|
"""
|
||||||
def check_welcome_tour() -> bool:
|
def check_welcome_tour() -> bool:
|
||||||
if "rewards.bing.com/welcometour" not in driver.current_url:
|
if "rewards.bing.com/welcometour" not in driver.current_url:
|
||||||
return False
|
return False
|
||||||
@ -236,6 +240,27 @@ def all_cards():
|
|||||||
# les éléments sont présents dans le DOM même quand la popup n'est pas visible apparemment
|
# les éléments sont présents dans le DOM même quand la popup n'est pas visible apparemment
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def check_streak_protection_expired() -> bool:
|
||||||
|
"""
|
||||||
|
Non, vous avez utilisé tous vos jours de protection contre les séries !
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
streak_protection_close = driver.find_element(By.ID, "streak-protection-popup-close-cross")
|
||||||
|
ok_sad_button = driver.find_elements(By.CLASS_NAME, "dashboardPopUpPopUpSelectButton")
|
||||||
|
ok_sad_button[0].click()
|
||||||
|
info("Popup 'Streak Protection fully used' reçue")
|
||||||
|
custom_sleep(1.5)
|
||||||
|
|
||||||
|
return True
|
||||||
|
except (exceptions.NoSuchElementException, exceptions.ElementNotInteractableException, IndexError):
|
||||||
|
return False
|
||||||
|
|
||||||
|
return (
|
||||||
|
check_welcome_tour()
|
||||||
|
or check_streak_protection()
|
||||||
|
or check_streak_protection_expired()
|
||||||
|
)
|
||||||
|
|
||||||
driver.get("https://rewards.bing.com")
|
driver.get("https://rewards.bing.com")
|
||||||
wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver)
|
wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver)
|
||||||
|
|
||||||
@ -289,8 +314,7 @@ def all_cards():
|
|||||||
activity = ""
|
activity = ""
|
||||||
|
|
||||||
custom_sleep(1.5)
|
custom_sleep(1.5)
|
||||||
check_welcome_tour()
|
check_popups()
|
||||||
check_streak_protection()
|
|
||||||
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
|
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
|
||||||
custom_sleep(1.5)
|
custom_sleep(1.5)
|
||||||
card_list[i].click()
|
card_list[i].click()
|
||||||
@ -307,8 +331,7 @@ def all_cards():
|
|||||||
if "mee-icon-AddMedium" not in card_list[i].get_attribute("innerHTML"):
|
if "mee-icon-AddMedium" not in card_list[i].get_attribute("innerHTML"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
check_welcome_tour()
|
check_popups()
|
||||||
check_streak_protection()
|
|
||||||
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
|
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
|
||||||
card_list[i].click()
|
card_list[i].click()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user