From 19cf77c6bd1e9902cbf0394256a722b6b666f46a Mon Sep 17 00:00:00 2001 From: augustin64 Date: Sat, 13 Apr 2024 10:57:32 +0200 Subject: [PATCH] make an actual choice --- V6.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/V6.py b/V6.py index 43ea44e..3b0c65c 100755 --- a/V6.py +++ b/V6.py @@ -9,7 +9,7 @@ from modules.db import add_to_database from modules.driver_tools import * from modules.error import * -from selenium.common.exceptions import ElementClickInterceptedException +import random # create a webdriver @@ -204,11 +204,18 @@ def all_cards(): return False info("Popup 'Explorer le programme' reçue") - wait_until_visible(By.CSS_SELECTOR, '[aria-label="Boîte de dialogue Récompenses"]', timeout=10, browser=driver) + wait_until_visible(By.ID, "welcome-tour", timeout=5, browser=driver) custom_sleep(1.5) - 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() + + 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