updated login to have a fallback
This commit is contained in:
parent
fd22c9e176
commit
69e8916a05
42
V4.py
42
V4.py
@ -350,7 +350,7 @@ def PlayQuiz8(override=3):
|
|||||||
if 'iscorrectoption="True" ' in Card.get_attribute("outerHTML"):
|
if 'iscorrectoption="True" ' in Card.get_attribute("outerHTML"):
|
||||||
ListeOfGood.append(f"rqAnswerOption{i-1}") # premier div = 3 ?
|
ListeOfGood.append(f"rqAnswerOption{i-1}") # premier div = 3 ?
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LogError("playuiz8 - 1 - " + e)
|
LogError("playquiz8 - 1 - " + e)
|
||||||
shuffle(ListeOfGood)
|
shuffle(ListeOfGood)
|
||||||
|
|
||||||
for i in ListeOfGood:
|
for i in ListeOfGood:
|
||||||
@ -367,13 +367,13 @@ def PlayQuiz8(override=3):
|
|||||||
LogError("playquizz8 - 2 - " + e)
|
LogError("playquizz8 - 2 - " + e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if override:
|
if override:
|
||||||
printf("playquiz8 - 3 -" + e)
|
printf("playquiz8 - 3 -" + e) # may append during
|
||||||
else:
|
else:
|
||||||
LogError("playquizz8 - 3 - " + e)
|
LogError("playquizz8 - 3 - " + e)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LogError("PlayQuiz8 - 4 - " + str(e))
|
LogError(f"PlayQuiz8 - 4 - {e} \n ListOfGood : {str(ListeOfGood)}")
|
||||||
print(str(ListeOfGood))
|
|
||||||
printf("PlayQuiz8 : fin ")
|
printf("PlayQuiz8 : fin ")
|
||||||
|
|
||||||
|
|
||||||
@ -518,13 +518,19 @@ def send_keys_wait(element, keys):
|
|||||||
|
|
||||||
|
|
||||||
def login():
|
def login():
|
||||||
|
global driver
|
||||||
printf("login : start")
|
printf("login : start")
|
||||||
try:
|
def sub_login():
|
||||||
driver.get("https://www.bing.com/rewardsapp/flyout")
|
driver.get("https://www.bing.com/rewardsapp/flyout")
|
||||||
try:
|
try:
|
||||||
driver.find_element(By.CSS_SELECTOR, f'[title="Rejoindre"]').click() # depend of the language of the page
|
driver.find_element(By.CSS_SELECTOR, f'[title="Rejoindre"]').click() # depend of the language of the page
|
||||||
except:
|
except:
|
||||||
|
try :
|
||||||
driver.find_element(By.CSS_SELECTOR, f'[title="Join now"]').click() # depend of the language of the page
|
driver.find_element(By.CSS_SELECTOR, f'[title="Join now"]').click() # depend of the language of the page
|
||||||
|
except Exception as e:
|
||||||
|
LogError(f"erreur de login : {e} - probablement deja log ou une langue inconnue")
|
||||||
|
return(driver.current_window_handle)
|
||||||
|
|
||||||
CustomSleep(10)
|
CustomSleep(10)
|
||||||
mail = driver.find_element(By.ID, "i0116")
|
mail = driver.find_element(By.ID, "i0116")
|
||||||
send_keys_wait(mail, _mail)
|
send_keys_wait(mail, _mail)
|
||||||
@ -539,22 +545,22 @@ def login():
|
|||||||
try:
|
try:
|
||||||
driver.find_element(By.ID, "KmsiCheckboxField").click()
|
driver.find_element(By.ID, "KmsiCheckboxField").click()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
printf(f"login - 1 - erreur validation bouton KmsiCheckboxField. pas forcement grave {e}")
|
printf(f"login - 2.1 - erreur validation bouton KmsiCheckboxField. pas forcement grave {e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
driver.find_element(By.ID, "iLooksGood").click()
|
driver.find_element(By.ID, "iLooksGood").click()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
printf(f"login - 2 - erreur validation bouton iLooksGood. pas forcement grave {e}")
|
printf(f"login - 2.2 - erreur validation bouton iLooksGood. pas forcement grave {e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
driver.find_element(By.ID, "idSIButton9").click()
|
driver.find_element(By.ID, "idSIButton9").click()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
printf(f"login - 2 - erreur validation bouton idSIButton9. pas forcement grave {e}")
|
printf(f"login - 2.3 - erreur validation bouton idSIButton9. pas forcement grave {e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
driver.find_element(By.ID, "iCancel").click()
|
driver.find_element(By.ID, "iCancel").click()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
printf(f"login - 2 - erreur validation bouton iCancel. pas forcement grave {e}")
|
printf(f"login - 2.4 - erreur validation bouton iCancel. pas forcement grave {e}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -562,11 +568,19 @@ def login():
|
|||||||
RGPD()
|
RGPD()
|
||||||
driver.get("https://www.bing.com/rewardsapp/flyout")
|
driver.get("https://www.bing.com/rewardsapp/flyout")
|
||||||
|
|
||||||
MainWindows = driver.current_window_handle
|
|
||||||
return MainWindows
|
|
||||||
|
|
||||||
|
for i in range(3) :
|
||||||
|
try :
|
||||||
|
sub_login()
|
||||||
|
return driver.current_window_handle
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LogError("login - 3 - " + str(e))
|
LogError("login - 3 - " + str(e))
|
||||||
|
driver.quit()
|
||||||
|
CustomSleep(1200)
|
||||||
|
driver = FirefoxDriver()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def BingPcSearch(override=randint(35, 40)):
|
def BingPcSearch(override=randint(35, 40)):
|
||||||
@ -807,7 +821,7 @@ def TryPlay(nom="inconnu"):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
printf(f"recovery détécté. quiz : {number}, restant : {restant +1}")
|
printf(f"recovery détécté. quiz : {number}, restant : {restant +1}")
|
||||||
play(number, override=restant + 1)
|
play(number-1, override=restant + 1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
printf("TryPlay - 2 - " + e)
|
printf("TryPlay - 2 - " + e)
|
||||||
|
|
||||||
@ -971,9 +985,11 @@ def check_proxy():
|
|||||||
CustomSleep(5)
|
CustomSleep(5)
|
||||||
LogError("test pour voir si le proxy marche")
|
LogError("test pour voir si le proxy marche")
|
||||||
|
|
||||||
|
|
||||||
def dev():
|
def dev():
|
||||||
printf("rien en cours de dev")
|
printf("rien en cours de dev")
|
||||||
|
|
||||||
|
|
||||||
def CustomStart(Credentials):
|
def CustomStart(Credentials):
|
||||||
if not IsLinux :
|
if not IsLinux :
|
||||||
raise NameError('You need to be on linux to do that, sorry.')
|
raise NameError('You need to be on linux to do that, sorry.')
|
||||||
@ -993,7 +1009,7 @@ def CustomStart(Credentials):
|
|||||||
_mail = Credentials[ids.index(i)][0]
|
_mail = Credentials[ids.index(i)][0]
|
||||||
_password = Credentials[ids.index(i)][1]
|
_password = Credentials[ids.index(i)][1]
|
||||||
driver = FirefoxDriver()
|
driver = FirefoxDriver()
|
||||||
driver.implicitly_wait(7)
|
driver.implicitly_wait(10)
|
||||||
|
|
||||||
login()
|
login()
|
||||||
if "tout" in Actions:
|
if "tout" in Actions:
|
||||||
|
Loading…
Reference in New Issue
Block a user