pas la seule occurrence évidemment

This commit is contained in:
augustin64 2024-04-12 23:46:26 +02:00
parent 68b5de32d6
commit d7d2f49a3f
1 changed files with 15 additions and 6 deletions

21
V6.py
View File

@ -198,6 +198,14 @@ def do_poll():
# Find each playable card and tries to click on it to earn points
def all_cards():
driver = config.WebDriver.driver
def popup_exploration():
debug("Popup 'Explorer le programme' reçue")
rewards_box = driver.find_element_by_css_selector('[aria-label="Boîte de dialogue Récompenses"]')
close_button = driver.find_element_by_css_selector('[aria-label="Fermer"]')
close_button.click()
custom_sleep(1.5)
driver.get("https://rewards.bing.com")
wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver)
@ -248,11 +256,7 @@ def all_cards():
try:
card_list[i].click()
except ElementClickInterceptedException: # Popup "Explorer le programme"
debug("Popup 'Explorer le programme' reçue")
rewards_box = driver.find_element_by_css_selector('[aria-label="Boîte de dialogue Récompenses"]')
close_button = driver.find_element_by_css_selector('[aria-label="Fermer"]')
close_button.click()
custom_sleep(1.5)
popup_exploration()
card_list[i].click()
if len(driver.window_handles) > 1:
@ -266,7 +270,12 @@ def all_cards():
if "mee-icon-AddMedium" in card_list[i].get_attribute("innerHTML"):
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
card_list[i].click()
try:
card_list[i].click()
except ElementClickInterceptedException: # Popup "Explorer le programme"
popup_exploration()
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 ?")