Compare commits
No commits in common. "9bd96ad876fcf3c2ef8624b7e5da3824a3a8c1bd" and "c5e9fb1267573445f49898d4f36f16c7314b0dcd" have entirely different histories.
9bd96ad876
...
c5e9fb1267
89
V6.py
89
V6.py
|
@ -9,8 +9,6 @@ from modules.db import add_to_database
|
||||||
from modules.driver_tools import *
|
from modules.driver_tools import *
|
||||||
from modules.error import *
|
from modules.error import *
|
||||||
|
|
||||||
import random
|
|
||||||
|
|
||||||
|
|
||||||
# create a webdriver
|
# create a webdriver
|
||||||
def create_driver(mobile=False):
|
def create_driver(mobile=False):
|
||||||
|
@ -198,27 +196,6 @@ def do_poll():
|
||||||
# Find each playable card and tries to click on it to earn points
|
# Find each playable card and tries to click on it to earn points
|
||||||
def all_cards():
|
def all_cards():
|
||||||
driver = config.WebDriver.driver
|
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")
|
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)
|
||||||
|
|
||||||
|
@ -262,47 +239,39 @@ def all_cards():
|
||||||
if i == len(card_list) and i > 15:
|
if i == len(card_list) and i > 15:
|
||||||
checked = False
|
checked = False
|
||||||
|
|
||||||
if not checked:
|
if checked:
|
||||||
continue
|
custom_sleep(1.5)
|
||||||
|
|
||||||
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])
|
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
|
||||||
|
custom_sleep(1.5)
|
||||||
card_list[i].click()
|
card_list[i].click()
|
||||||
|
|
||||||
driver.switch_to.window(driver.window_handles[1])
|
if len(driver.window_handles) > 1:
|
||||||
custom_sleep(10)
|
driver.switch_to.window(driver.window_handles[1])
|
||||||
log_error(f"Card {i} Can't be completed. Why MS ?")
|
try_play(driver.title)
|
||||||
try:
|
close_tab(driver.window_handles[1])
|
||||||
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:
|
try:
|
||||||
log_error(err)
|
driver.refresh()
|
||||||
custom_sleep(3)
|
card_list = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
def promo():
|
def promo():
|
||||||
|
|
Loading…
Reference in New Issue