This commit is contained in:
piair 2023-04-13 22:38:27 +02:00
parent f8f3ff2382
commit 8d53a2b30b
2 changed files with 6 additions and 5 deletions

9
V5.py
View File

@ -234,7 +234,7 @@ def all_cards():
liste[i].click() liste[i].click()
if len(driver.window_handles) > 1 : if len(driver.window_handles) > 1 :
driver.switch_to.window(driver.window_handles[1]) driver.switch_to.window(driver.window_handles[1])
try_play() try_play(driver.title)
close_tab(driver.window_handles[1]) close_tab(driver.window_handles[1])
try : try :
driver.refresh() driver.refresh()
@ -243,7 +243,7 @@ def all_cards():
printf(f"carte {i} not okay. Retrying.") printf(f"carte {i} not okay. Retrying.")
liste[i].click() liste[i].click()
driver.switch_to.window(driver.window_handles[1]) driver.switch_to.window(driver.window_handles[1])
try_play() try_play(driver.title)
close_tab(driver.window_handles[1]) close_tab(driver.window_handles[1])
except : except :
pass pass
@ -255,6 +255,7 @@ def all_cards():
log_error("no new windows", driver) log_error("no new windows", driver)
custom_sleep(3) custom_sleep(3)
def welcome_tour(elm): def welcome_tour(elm):
try : try :
driver.find_element(By.CSS_SELECTOR, '[class="welcome-tour-next-button c-call-to-action c-glyph"]').click() driver.find_element(By.CSS_SELECTOR, '[class="welcome-tour-next-button c-call-to-action c-glyph"]').click()
@ -272,12 +273,14 @@ def welcome_tour(elm):
sleep(5) sleep(5)
driver.find_element(By.CSS_SELECTOR, '[class="c-glyph glyph-cancel"]').click() driver.find_element(By.CSS_SELECTOR, '[class="c-glyph glyph-cancel"]').click()
def spotify(): def spotify():
custom_sleep(5) custom_sleep(5)
driver.find_element(By.CSS_SELECTOR, '[data-bi-id="spotify-premium gratuit"]').click() driver.find_element(By.CSS_SELECTOR, '[data-bi-id="spotify-premium gratuit"]').click()
custom_sleep(5) custom_sleep(5)
close_tab(driver.window_handles[1]) close_tab(driver.window_handles[1])
def promo(): def promo():
elm = driver.find_element(By.ID, "promo-item") elm = driver.find_element(By.ID, "promo-item")
while elm: while elm:
@ -296,8 +299,6 @@ def promo():
# Find out which type of action to do # Find out which type of action to do
def try_play(nom="inconnu"): def try_play(nom="inconnu"):
if (nom=="inconnu"):
nom = driver.title
def play(number): def play(number):
if number == 8 or number == 9: if number == 8 or number == 9:
try: try:

View File

@ -1 +1 @@
v5.8.0 v5.8.1