welcome-tour: URL check
This commit is contained in:
parent
fcb40537dc
commit
ae023688a4
85
V6.py
85
V6.py
|
@ -199,12 +199,16 @@ def do_poll():
|
|||
def all_cards():
|
||||
driver = config.WebDriver.driver
|
||||
|
||||
def popup_exploration():
|
||||
debug("Popup 'Explorer le programme' reçue")
|
||||
def check_welcome_tour() -> bool:
|
||||
if "rewards.bing.com/welcometour" not in driver.current_url:
|
||||
return False
|
||||
|
||||
info("Popup 'Explorer le programme' reçue")
|
||||
rewards_box = driver.find_element(By.CSS_SELECTOR, '[aria-label="Boîte de dialogue Récompenses"]')
|
||||
close_button = rewards_box.find_element(By.CSS_SELECTOR, '[aria-label="Fermer"]')
|
||||
close_button.click()
|
||||
custom_sleep(1.5)
|
||||
return True
|
||||
|
||||
driver.get("https://rewards.bing.com")
|
||||
wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver)
|
||||
|
@ -249,48 +253,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)
|
||||
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
|
||||
custom_sleep(1.5)
|
||||
check_welcome_tour()
|
||||
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
|
||||
|
||||
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
|
||||
custom_sleep(1.5)
|
||||
check_welcome_tour()
|
||||
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:
|
||||
card_list[i].click()
|
||||
except ElementClickInterceptedException: # Popup "Explorer le programme"
|
||||
popup_exploration()
|
||||
card_list[i].click()
|
||||
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 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" in card_list[i].get_attribute("innerHTML"):
|
||||
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
|
||||
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 ?")
|
||||
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():
|
||||
|
|
Loading…
Reference in New Issue