don't know
This commit is contained in:
parent
ed1e91b304
commit
d946298a38
29
V5.py
29
V5.py
|
@ -234,6 +234,7 @@ def all_cards():
|
||||||
try :
|
try :
|
||||||
checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
|
checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
|
||||||
except StaleElementReferenceException :
|
except StaleElementReferenceException :
|
||||||
|
driver.refresh()
|
||||||
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
||||||
printf(f"staled, {len(liste)}")
|
printf(f"staled, {len(liste)}")
|
||||||
checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
|
checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
|
||||||
|
@ -255,11 +256,17 @@ def all_cards():
|
||||||
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
||||||
if ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML")) :
|
if ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML")) :
|
||||||
printf(f"carte {i} not okay. Retrying.")
|
printf(f"carte {i} not okay. Retrying.")
|
||||||
liste[i].click()
|
try :
|
||||||
log_error(f"Card {i} with issue. WTF ?", driver)
|
liste[i].click()
|
||||||
|
except :
|
||||||
|
log_error("problème inconnu ? sauf si c'est un element obscure...", driver)
|
||||||
|
driver.get("https://rewards.bing.com")
|
||||||
|
checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
|
||||||
driver.switch_to.window(driver.window_handles[1])
|
driver.switch_to.window(driver.window_handles[1])
|
||||||
try_play(driver.title)
|
try_play(driver.title)
|
||||||
close_tab(driver.window_handles[1])
|
close_tab(driver.window_handles[1])
|
||||||
|
if ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML")):
|
||||||
|
log_error(f"Card {i} with issue. Why MS ?", driver)
|
||||||
except :
|
except :
|
||||||
pass
|
pass
|
||||||
else :
|
else :
|
||||||
|
@ -288,7 +295,7 @@ def promo():
|
||||||
try :
|
try :
|
||||||
spotify(driver)
|
spotify(driver)
|
||||||
except :
|
except :
|
||||||
log_error("no new windows", driver)
|
printf("no new windows", driver)
|
||||||
driver.get("https://rewards.bing.com")
|
driver.get("https://rewards.bing.com")
|
||||||
custom_sleep(3)
|
custom_sleep(3)
|
||||||
|
|
||||||
|
@ -404,6 +411,11 @@ def login_part_2(ldriver, cookies = False):
|
||||||
custom_sleep(5)
|
custom_sleep(5)
|
||||||
if ('Abuse' in ldriver.current_url) :
|
if ('Abuse' in ldriver.current_url) :
|
||||||
raise Banned()
|
raise Banned()
|
||||||
|
if ('identity' in ldriver.current_url) :
|
||||||
|
custom_sleep(100)
|
||||||
|
raise Identity()
|
||||||
|
if ('notice' in ldriver.current_url) :
|
||||||
|
ldriver.find_element(By.ID, "id__0").click()
|
||||||
if cookies:
|
if cookies:
|
||||||
save_cookies(ldriver)
|
save_cookies(ldriver)
|
||||||
for id in ["KmsiCheckboxField", "id__0", "iLooksGood", "idSIButton9", "iCancel"]:
|
for id in ["KmsiCheckboxField", "id__0", "iLooksGood", "idSIButton9", "iCancel"]:
|
||||||
|
@ -419,14 +431,7 @@ def login_part_2(ldriver, cookies = False):
|
||||||
rgpd_popup(ldriver)
|
rgpd_popup(ldriver)
|
||||||
ldriver.refresh()
|
ldriver.refresh()
|
||||||
rgpd_popup(ldriver)
|
rgpd_popup(ldriver)
|
||||||
#ldriver.get("https://account.microsoft.com/")
|
|
||||||
#if wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 30, ldriver) :
|
|
||||||
# return(True) #the account logging was successful
|
|
||||||
#else :
|
|
||||||
# log_error("Error during login. Trying to refresh")
|
|
||||||
# ldriver.refresh()
|
|
||||||
# return(wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 30, ldriver))
|
|
||||||
# useless ?
|
|
||||||
|
|
||||||
# login() tries to login to your Microsoft account.
|
# login() tries to login to your Microsoft account.
|
||||||
# it uses global variable g._mail and g._password to login
|
# it uses global variable g._mail and g._password to login
|
||||||
|
@ -439,6 +444,8 @@ def login(ldriver):
|
||||||
ldriver.get("https://rewards.bing.com/")
|
ldriver.get("https://rewards.bing.com/")
|
||||||
except Banned:
|
except Banned:
|
||||||
raise Banned()
|
raise Banned()
|
||||||
|
except Identity:
|
||||||
|
raise Banned()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(e)
|
log_error(e)
|
||||||
ldriver.quit()
|
ldriver.quit()
|
||||||
|
|
|
@ -2,4 +2,7 @@ class Banned(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class NotBanned(Exception):
|
class NotBanned(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Identity(Exception):
|
||||||
pass
|
pass
|
Loading…
Reference in New Issue