Compare commits

...

10 Commits

Author SHA1 Message Date
augustin64 9bd96ad876 version bump 2024-04-13 11:09:30 +02:00
augustin64 ed517e7b03 Fix 'Welcome Tour'
Reviewed-on: https://gitea.augustin64.fr/piair/MsRewards-Reborn/pulls/11
2024-04-13 11:07:04 +02:00
augustin64 01416c0e11 Check before scrolling, but should be good to merge ! 2024-04-13 11:01:25 +02:00
augustin64 19cf77c6bd make an actual choice 2024-04-13 10:57:32 +02:00
augustin64 feb7834d1f sleep a bit 2024-04-13 10:26:53 +02:00
augustin64 1ea1ff776e wait until visible 2024-04-13 10:26:21 +02:00
augustin64 ae023688a4 welcome-tour: URL check 2024-04-13 10:15:26 +02:00
augustin64 fcb40537dc Use newer method 2024-04-13 10:06:21 +02:00
augustin64 d7d2f49a3f pas la seule occurrence évidemment 2024-04-12 23:46:26 +02:00
augustin64 68b5de32d6 fix de la popup "explorer le programme"
peu satisfaisant, consiste juste à fermer la popup à chaque fois qu'elle apparaît sans s'en débarrasser définitivement
2024-04-12 23:28:46 +02:00
2 changed files with 60 additions and 29 deletions

87
V6.py
View File

@ -9,6 +9,8 @@ from modules.db import add_to_database
from modules.driver_tools import *
from modules.error import *
import random
# create a webdriver
def create_driver(mobile=False):
@ -196,6 +198,27 @@ def do_poll():
# Find each playable card and tries to click on it to earn points
def all_cards():
driver = config.WebDriver.driver
def check_welcome_tour() -> 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
driver.get("https://rewards.bing.com")
wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver)
@ -239,39 +262,47 @@ def all_cards():
if i == len(card_list) and i > 15:
checked = False
if checked:
custom_sleep(1.5)
if not checked:
continue
custom_sleep(1.5)
check_welcome_tour()
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
custom_sleep(1.5)
card_list[i].click()
if len(driver.window_handles) > 1:
driver.switch_to.window(driver.window_handles[1])
try_play(driver.title)
close_tab(driver.window_handles[1])
try:
driver.refresh()
card_list = driver.find_elements(By.CLASS_NAME, "c-card-content")
if "mee-icon-AddMedium" not in card_list[i].get_attribute("innerHTML"):
continue
check_welcome_tour()
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
custom_sleep(1.5)
card_list[i].click()
if len(driver.window_handles) > 1:
driver.switch_to.window(driver.window_handles[1])
try_play(driver.title)
close_tab(driver.window_handles[1])
driver.switch_to.window(driver.window_handles[1])
custom_sleep(10)
log_error(f"Card {i} Can't be completed. Why MS ?")
try:
driver.refresh()
card_list = driver.find_elements(By.CLASS_NAME, "c-card-content")
try_play(driver.title) # go back to the main page
try:
close_tab(driver.window_handles[1])
except Exception as e:
debug(e)
except Exception as e:
debug(e)
driver.get("https://rewards.bing.com")
if "mee-icon-AddMedium" in card_list[i].get_attribute("innerHTML"):
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
card_list[i].click()
driver.switch_to.window(driver.window_handles[1])
custom_sleep(10)
log_error(f"Card {i} Can't be completed. Why MS ?")
try:
try_play(driver.title) # go back to the main page
try:
close_tab(driver.window_handles[1])
except Exception as e:
debug(e)
except Exception as e:
debug(e)
driver.get("https://rewards.bing.com")
except Exception as err:
log_error(err)
custom_sleep(3)
except Exception as err:
log_error(err)
custom_sleep(3)
def promo():

View File

@ -1 +1 @@
v6.8.47
v6.8.48