idk anymore

This commit is contained in:
piair 2022-08-29 11:36:08 +02:00
parent 1e33769c0d
commit 593ddbf4fc
1 changed files with 7 additions and 7 deletions

12
V4.py
View File

@ -269,12 +269,12 @@ def ListTabs(Mdriver=None):
def LogError(message, log=FullLog, Mobdriver=None): def LogError(message, log=FullLog, Mobdriver=None):
print(f"\n\n\033[93m Erreur : {str(message)} \033[0m\n\n")
if Mobdriver: if Mobdriver:
gdriver = Mobdriver gdriver = Mobdriver
else: else:
gdriver = driver gdriver = driver
if not log:
print(f"\n\n\033[93m Erreur : {str(message)} \033[0m\n\n")
if IsLinux: if IsLinux:
with open("page.html", "w") as f: with open("page.html", "w") as f:
f.write(gdriver.page_source) f.write(gdriver.page_source)
@ -569,14 +569,16 @@ it uses global variable _mail and _password to login
""" """
def login(): def login():
global driver global driver
printf("login : start")
def sub_login(): def sub_login():
printf("sublogin : start")
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 :
raise ValueError('already logged in')
CustomSleep(10) CustomSleep(10)
mail = driver.find_element(By.ID, "i0116") mail = driver.find_element(By.ID, "i0116")
@ -587,8 +589,6 @@ def login():
send_keys_wait(pwd, _password) send_keys_wait(pwd, _password)
pwd.send_keys(Keys.ENTER) pwd.send_keys(Keys.ENTER)
CustomSleep(5) CustomSleep(5)
printf("pwd envoyé")
try: try:
driver.find_element(By.ID, "KmsiCheckboxField").click() driver.find_element(By.ID, "KmsiCheckboxField").click()
except Exception as e: except Exception as e: