Don't update yet

This commit is contained in:
piair 2023-03-29 23:09:16 +02:00
parent c5beafe036
commit 0cb0521da6
1 changed files with 23 additions and 5 deletions

24
V5.py
View File

@ -62,7 +62,10 @@ def log_error(error, ldriver=driver, log=FULL_LOG):
print(f"\n\n\033[93m Erreur : {str(error)} \033[0m\n\n")
if DISCORD_ENABLED_ERROR:
with open("page.html", "w") as f:
try :
f.write(ldriver.page_source)
except :
f.write("the driver has closed or crashed. Can't access page content")
try :
img = display.waitgrab()
img.save("screenshot.png")
@ -468,10 +471,25 @@ def login(ldriver):
ldriver.refresh()
rgpd_popup(ldriver)
ldriver.get("https://www.bing.com/rewardsapp/flyout")
if ("Rejoindre maintenant" in ldriver.page_source):
log_error("Not Connected 1", ldriver, True)
if not('class="b_subtitle bt_join"' in ldriver.page_source):
log_error(f"Not Connected 1. autre tag : {'>Tableau de bord' in ldriver.page_source}", ldriver, True)
ldriver.refresh()
log_error("Not Connected 2", ldriver, True)
if not('class="b_subtitle bt_join"' in ldriver.page_source):
log_error("Not connected 3", ldriver, True)
try :
driver.find_element(By.CSS_SELECTOR, "[h='ID=RewardsFlyout,2.1']").click()
log_error("not connected 5", ldriver, True)
except Exception as e:
log_error(f"not connected 5 - error {e}", ldriver)
if not('class="b_subtitle bt_join"' in ldriver.page_source):
try :
driver.find_element(By.XPATH, "/html/body/div/div/div/div/div[2]/a").click()
except Exception as e:
log_error(f"erreur not connected 6{e}", ldriver)
log_error("not connected 6", ldriver, True)
return(True)
print("cookies plus valides ?")
return(False)
@ -479,7 +497,7 @@ def login(ldriver):
try :
if cookie_login():
return (ldriver.current_window_handle)
pwd_login()
pwd_login() #mobile login in never called. TODO : check if it's bad.
return(ldriver.current_window_handle)
except Banned:
raise Banned()