Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
45ea72a354
105
V6.py
105
V6.py
@ -200,41 +200,66 @@ def do_poll():
|
|||||||
def all_cards():
|
def all_cards():
|
||||||
driver = config.WebDriver.driver
|
driver = config.WebDriver.driver
|
||||||
|
|
||||||
def check_welcome_tour() -> bool:
|
def check_popups() -> bool:
|
||||||
if "rewards.bing.com/welcometour" not in driver.current_url:
|
|
||||||
return False
|
|
||||||
|
|
||||||
info("Popup 'Explorer le programme' reçue")
|
|
||||||
wait_until_visible(By.ID, "welcome-tour", timeout=5, browser=driver)
|
|
||||||
custom_sleep(1.5)
|
|
||||||
|
|
||||||
welcome_tour = driver.find_element(By.ID, "welcome-tour")
|
|
||||||
interest_button_box = welcome_tour.find_element(By.CLASS_NAME, "interest-buttons")
|
|
||||||
interests = interest_button_box.find_elements(By.CLASS_NAME, "ng-binding")
|
|
||||||
debug("Got the following interests: " + str(interests))
|
|
||||||
random.choice(interests).click() # Choose interest
|
|
||||||
custom_sleep(1.5)
|
|
||||||
|
|
||||||
claim_button = welcome_tour.find_element(By.ID, "claim-button")
|
|
||||||
claim_button.click() # submit
|
|
||||||
custom_sleep(1.5)
|
|
||||||
return True
|
|
||||||
|
|
||||||
def check_streak_protection() -> bool:
|
|
||||||
"""
|
"""
|
||||||
Ne perdez plus jamais votre série !
|
Check various annoying popups
|
||||||
"""
|
"""
|
||||||
try:
|
def check_welcome_tour() -> bool:
|
||||||
streak_protection_close = driver.find_element(By.ID, "streak-protection-popup-close-cross")
|
if "rewards.bing.com/welcometour" not in driver.current_url:
|
||||||
streak_protection_activate = driver.find_elements(By.CLASS_NAME, "earningPagePopUpPopUpSelectButton")
|
return False
|
||||||
streak_protection_activate[0].click()
|
|
||||||
info("Popup 'Streak Protection' reçue")
|
info("Popup 'Explorer le programme' reçue")
|
||||||
|
wait_until_visible(By.ID, "welcome-tour", timeout=5, browser=driver)
|
||||||
custom_sleep(1.5)
|
custom_sleep(1.5)
|
||||||
|
|
||||||
|
welcome_tour = driver.find_element(By.ID, "welcome-tour")
|
||||||
|
interest_button_box = welcome_tour.find_element(By.CLASS_NAME, "interest-buttons")
|
||||||
|
interests = interest_button_box.find_elements(By.CLASS_NAME, "ng-binding")
|
||||||
|
debug("Got the following interests: " + str(interests))
|
||||||
|
random.choice(interests).click() # Choose interest
|
||||||
|
custom_sleep(1.5)
|
||||||
|
|
||||||
|
claim_button = welcome_tour.find_element(By.ID, "claim-button")
|
||||||
|
claim_button.click() # submit
|
||||||
|
custom_sleep(1.5)
|
||||||
return True
|
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
|
def check_streak_protection() -> bool:
|
||||||
return False
|
"""
|
||||||
|
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
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
@ -515,11 +538,15 @@ def login_part_1():
|
|||||||
info("Starting part 1 of login")
|
info("Starting part 1 of login")
|
||||||
driver = config.WebDriver.driver
|
driver = config.WebDriver.driver
|
||||||
driver.get("https://login.live.com")
|
driver.get("https://login.live.com")
|
||||||
wait_until_visible(By.ID, "i0116", browser=driver)
|
try:
|
||||||
send_wait_and_confirm(
|
wait_until_visible(By.ID, "i0116", browser=driver)
|
||||||
driver.find_element(By.ID, "i0116"),
|
send_wait_and_confirm(
|
||||||
config.UserCredentials.get_mail()
|
driver.find_element(By.ID, "i0116"),
|
||||||
)
|
config.UserCredentials.get_mail()
|
||||||
|
)
|
||||||
|
except exceptions.NoSuchElementException:
|
||||||
|
info("Unable to find mail input for login, might be semi-logged-in")
|
||||||
|
|
||||||
wait_until_visible(By.ID, "i0118", browser=driver)
|
wait_until_visible(By.ID, "i0118", browser=driver)
|
||||||
send_wait_and_confirm(
|
send_wait_and_confirm(
|
||||||
driver.find_element(By.ID, "i0118"),
|
driver.find_element(By.ID, "i0118"),
|
||||||
|
@ -5,7 +5,7 @@ import subprocess
|
|||||||
|
|
||||||
from logger import critical, info, error
|
from logger import critical, info, error
|
||||||
|
|
||||||
errorMessage = subprocess.run(['python3', 'generate_error.py'], check=False, stdout=subprocess.PIPE,
|
errorMessage = subprocess.run(['python3', '/app/MsRewards-Reborn/modules/Tools/generate_error.py'], check=False, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE).stderr.decode("utf-8")
|
stderr=subprocess.PIPE).stderr.decode("utf-8")
|
||||||
|
|
||||||
versionPattern = "This version of ChromeDriver only supports Chrome version ([0-9]+)"
|
versionPattern = "This version of ChromeDriver only supports Chrome version ([0-9]+)"
|
||||||
|
Loading…
Reference in New Issue
Block a user