Welcome Tour #11
21
V6.py
21
V6.py
@ -198,6 +198,14 @@ 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 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")
|
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)
|
||||||
|
|
||||||
@ -248,11 +256,7 @@ def all_cards():
|
|||||||
try:
|
try:
|
||||||
card_list[i].click()
|
card_list[i].click()
|
||||||
except ElementClickInterceptedException: # Popup "Explorer le programme"
|
except ElementClickInterceptedException: # Popup "Explorer le programme"
|
||||||
debug("Popup 'Explorer le programme' reçue")
|
popup_exploration()
|
||||||
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)
|
|
||||||
card_list[i].click()
|
card_list[i].click()
|
||||||
|
|
||||||
if len(driver.window_handles) > 1:
|
if len(driver.window_handles) > 1:
|
||||||
@ -266,7 +270,12 @@ def all_cards():
|
|||||||
|
|
||||||
if "mee-icon-AddMedium" in card_list[i].get_attribute("innerHTML"):
|
if "mee-icon-AddMedium" in card_list[i].get_attribute("innerHTML"):
|
||||||
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
|
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])
|
driver.switch_to.window(driver.window_handles[1])
|
||||||
custom_sleep(10)
|
custom_sleep(10)
|
||||||
log_error(f"Card {i} Can't be completed. Why MS ?")
|
log_error(f"Card {i} Can't be completed. Why MS ?")
|
||||||
|
Loading…
Reference in New Issue
Block a user