small fixes, testing tomorrow then releasing
This commit is contained in:
parent
2b1c7b985e
commit
ecd5a9f204
|
@ -1,7 +1,6 @@
|
||||||
/old
|
/old
|
||||||
geckodriver.log
|
geckodriver.log
|
||||||
.vscode/
|
.vscode/
|
||||||
update.sh
|
|
||||||
/Git
|
/Git
|
||||||
page.html
|
page.html
|
||||||
screenshot.png
|
screenshot.png
|
||||||
|
@ -11,5 +10,5 @@ data
|
||||||
/user_data
|
/user_data
|
||||||
install.sh
|
install.sh
|
||||||
nohup.out
|
nohup.out
|
||||||
test.py
|
|
||||||
points.csv
|
points.csv
|
||||||
|
/dev
|
||||||
|
|
26
V5.py
26
V5.py
|
@ -227,14 +227,13 @@ def all_cards():
|
||||||
driver.refresh()
|
driver.refresh()
|
||||||
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
||||||
if(len(liste) < 10):
|
if(len(liste) < 10):
|
||||||
log_error("moins de 10 cartes", driver)
|
log_error("Less than 10 cards. Most likely an error with login.", driver)
|
||||||
return("PAS ASSEZ DE CARTES")
|
return("PAS ASSEZ DE CARTES")
|
||||||
if (len(liste) < 20): # most likely not in france
|
if (len(liste) < 20): # most likely not in france
|
||||||
if not g.norvege :
|
if not g.norvege : # TODO : rename norvege to not_france or smth like that
|
||||||
g.norvege = True
|
g.norvege = True
|
||||||
printf("moins de 20 cartes, disabling fidelity")
|
printf("Most likely not in France, thus disabling France specific action")
|
||||||
g.fidelity_link = "Disabled because norway"
|
# TODO : check country for fidelity
|
||||||
log_error("Verifying if Norway", driver, True)
|
|
||||||
for i in range(len(liste)):
|
for i in range(len(liste)):
|
||||||
printf(f"carte {i}")
|
printf(f"carte {i}")
|
||||||
try :
|
try :
|
||||||
|
@ -245,7 +244,7 @@ def all_cards():
|
||||||
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"))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
driver.refresh()
|
driver.get("https://rewards.bing.com")
|
||||||
custom_sleep(10)
|
custom_sleep(10)
|
||||||
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
||||||
try :
|
try :
|
||||||
|
@ -296,7 +295,11 @@ def promo():
|
||||||
break
|
break
|
||||||
if i > 8 :
|
if i > 8 :
|
||||||
log_error("chelou, plus de 8 truc", driver)
|
log_error("chelou, plus de 8 truc", driver)
|
||||||
driver.execute_script("arguments[0].click();", elm)
|
try :
|
||||||
|
elm.click()
|
||||||
|
except :
|
||||||
|
driver.execute_script("arguments[0].click();", elm)
|
||||||
|
printf("that should't be there (promo)")
|
||||||
custom_sleep(3)
|
custom_sleep(3)
|
||||||
if len(driver.window_handles) > 1 :
|
if len(driver.window_handles) > 1 :
|
||||||
driver.switch_to.window(driver.window_handles[len(driver.window_handles)-1])
|
driver.switch_to.window(driver.window_handles[len(driver.window_handles)-1])
|
||||||
|
@ -308,6 +311,7 @@ def promo():
|
||||||
except :
|
except :
|
||||||
printf("no new windows", driver)
|
printf("no new windows", driver)
|
||||||
driver.get("https://rewards.bing.com")
|
driver.get("https://rewards.bing.com")
|
||||||
|
driver.refresh()
|
||||||
custom_sleep(3)
|
custom_sleep(3)
|
||||||
|
|
||||||
|
|
||||||
|
@ -429,6 +433,8 @@ def login_part_2(ldriver, cookies = False):
|
||||||
raise Identity()
|
raise Identity()
|
||||||
if ('notice' in ldriver.current_url) :
|
if ('notice' in ldriver.current_url) :
|
||||||
ldriver.find_element(By.ID, "id__0").click()
|
ldriver.find_element(By.ID, "id__0").click()
|
||||||
|
if ("proof" in ldriver.current_url):
|
||||||
|
ldriver.find_element(BY.ID, "iLooksGood")
|
||||||
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"]:
|
||||||
|
@ -627,7 +633,8 @@ def fidelity():
|
||||||
printf("fidelity - done")
|
printf("fidelity - done")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(e)
|
log_error(e)
|
||||||
|
if driver.current_url != "https://rewards.bing.com":
|
||||||
|
driver.get("https://rewards.bing.com")
|
||||||
pause = driver.find_element(By.CSS_SELECTOR, f'[class="c-action-toggle c-glyph f-toggle glyph-pause"]') # mettre le truc en pause
|
pause = driver.find_element(By.CSS_SELECTOR, f'[class="c-action-toggle c-glyph f-toggle glyph-pause"]') # mettre le truc en pause
|
||||||
pause.click()
|
pause.click()
|
||||||
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
|
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
|
||||||
|
@ -646,7 +653,8 @@ def fidelity():
|
||||||
sub_fidelity()
|
sub_fidelity()
|
||||||
close_tab(driver.window_handles[1])
|
close_tab(driver.window_handles[1])
|
||||||
custom_sleep(1)
|
custom_sleep(1)
|
||||||
|
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
|
||||||
|
checked_list_all = driver.find_elements(By.CSS_SELECTOR, f'[ng-if="$ctrl.complete"]')
|
||||||
|
|
||||||
def mobile_alert_popup():
|
def mobile_alert_popup():
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue