better
This commit is contained in:
parent
11eaa5189a
commit
f668c49e09
49
V4.py
49
V4.py
|
@ -14,7 +14,6 @@ from selenium.webdriver.common.keys import Keys
|
||||||
from selenium.webdriver.firefox.options import Options
|
from selenium.webdriver.firefox.options import Options
|
||||||
from selenium.webdriver.support.ui import WebDriverWait
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
from selenium.webdriver.support import expected_conditions as EC
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
from selenium.common.exceptions import TimeoutException, NoSuchElementException
|
|
||||||
|
|
||||||
from modules.db import add_to_database
|
from modules.db import add_to_database
|
||||||
from modules.config import *
|
from modules.config import *
|
||||||
|
@ -129,7 +128,7 @@ def Close(fenetre, SwitchTo=0):
|
||||||
def RGPD():
|
def RGPD():
|
||||||
for i in ["bnp_btn_accept", "bnp_hfly_cta2", "bnp_hfly_close"] :
|
for i in ["bnp_btn_accept", "bnp_hfly_cta2", "bnp_hfly_close"] :
|
||||||
try:
|
try:
|
||||||
driver.find_element(By.ID, ).click()
|
driver.find_element(By.ID, i).click()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -173,51 +172,41 @@ def PlayQuiz2(override=10):
|
||||||
printf("PlayQuiz2 finis")
|
printf("PlayQuiz2 finis")
|
||||||
|
|
||||||
|
|
||||||
def PlayQuiz8(override=3):
|
def PlayQuiz8():
|
||||||
|
override = len(findall("<span id=\"rqQuestionState.\" class=\"emptyCircle\"></span>", driver.page_source))+1
|
||||||
printf(f"PlayQuiz8 : start, override : {override}")
|
printf(f"PlayQuiz8 : start, override : {override}")
|
||||||
try:
|
try:
|
||||||
c = 0
|
c = 0
|
||||||
for i in range(override):
|
for i in range(override):
|
||||||
RGPD()
|
RGPD()
|
||||||
CustomSleep(uniform(3, 5))
|
CustomSleep(uniform(3, 5))
|
||||||
ListeOfGood = []
|
AnswerOptions = [ (driver.find_element(By.ID, f"rqAnswerOption{i-1}"),f'rqAnswerOption{i-1}') for i in range(1,9)]
|
||||||
for i in range(1, 9):
|
isCorrect = [x[1] for x in AnswerOptions if 'iscorrectoption="True" ' in x[0].get_attribute("outerHTML") ]
|
||||||
try:
|
shuffle(isCorrect)
|
||||||
Card = driver.find_element(By.ID, f"rqAnswerOption{i-1}")
|
|
||||||
if 'iscorrectoption="True" ' in Card.get_attribute("outerHTML"):
|
|
||||||
ListeOfGood.append(f"rqAnswerOption{i-1}") # premier div = 3 ?
|
|
||||||
except Exception as e:
|
|
||||||
LogError(f"playquiz8 - 1 - {e}", driver, _mail)
|
|
||||||
shuffle(ListeOfGood)
|
|
||||||
|
|
||||||
for i in ListeOfGood:
|
for i in isCorrect:
|
||||||
CustomSleep(uniform(3, 5))
|
try :
|
||||||
|
WaitUntilVisible(By.ID, i, to = 20, browser=driver)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
print("wait")
|
||||||
c += 1
|
c += 1
|
||||||
progressBar(c, 16, name="Quiz 8 ")
|
progressBar(c, 16, name="Quiz 8 ")
|
||||||
try:
|
try:
|
||||||
elem = driver.find_element(By.ID, i)
|
elem = driver.find_element(By.ID, i)
|
||||||
elem.click()
|
elem.click()
|
||||||
except exceptions.ElementNotInteractableException as e:
|
except exceptions.NoSuchElementException :
|
||||||
try:
|
|
||||||
driver.execute_script("arguments[0].click();", elem)
|
|
||||||
except Exception as e:
|
|
||||||
LogError(f"playquizz8 - 2 - {e}", driver, _mail)
|
|
||||||
except exceptions.NoSuchElementException as e :
|
|
||||||
try :
|
|
||||||
driver.refresh()
|
driver.refresh()
|
||||||
CustomSleep(10)
|
CustomSleep(10)
|
||||||
elem = driver.find_element(By.ID, i)
|
elem = driver.find_element(By.ID, i)
|
||||||
elem.click()
|
elem.click()
|
||||||
except Exception as e :
|
except ElementClickInterceptedException :
|
||||||
LogError(f"playquizz8 - 5 - {e}", driver, _mail)
|
RGPD()
|
||||||
except Exception as e:
|
isCorrect.append(i)
|
||||||
if CUSTOM_START:
|
|
||||||
printf(f"playquiz8 - 3 - {e}") # may append during
|
|
||||||
else:
|
|
||||||
LogError(f"playquizz8 - 3 - {e}", driver, _mail)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LogError(f"PlayQuiz8 - 4 - {e} \n ListOfGood : {str(ListeOfGood)}", driver, _mail)
|
LogError(f"PlayQuiz8 - 4 - {e} \n ListOfGood : {str(isCorrect)}", driver, _mail)
|
||||||
|
|
||||||
printf("PlayQuiz8 : fin ")
|
printf("PlayQuiz8 : fin ")
|
||||||
|
|
||||||
|
@ -906,7 +895,7 @@ elif UNBAN:
|
||||||
LogError("you are not cureently banned on this account")
|
LogError("you are not cureently banned on this account")
|
||||||
else:
|
else:
|
||||||
for _mail, _password in Credentials:
|
for _mail, _password in Credentials:
|
||||||
system("pkill -9 firefox")
|
#system("pkill -9 firefox")
|
||||||
print("\n\n")
|
print("\n\n")
|
||||||
print(_mail)
|
print(_mail)
|
||||||
CustomSleep(1)
|
CustomSleep(1)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from selenium.common.exceptions import TimeoutException, NoSuchElementException, ElementClickInterceptedException
|
||||||
|
|
||||||
class Banned(Exception):
|
class Banned(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ def CustomSleep(temps):
|
||||||
else:
|
else:
|
||||||
sleep(temps)
|
sleep(temps)
|
||||||
except KeyboardInterrupt :
|
except KeyboardInterrupt :
|
||||||
printf("attente annulée", _mail)
|
printf("attente annulée")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue