Fix Logging
This commit is contained in:
parent
c6543663a1
commit
7844f8a20d
@ -26,6 +26,9 @@ class Bot:
|
|||||||
'https://exam.global-exam.com/library/study-sheets/categories/vocabulary']
|
'https://exam.global-exam.com/library/study-sheets/categories/vocabulary']
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
|
"""
|
||||||
|
Actions for the login form
|
||||||
|
"""
|
||||||
email_el = WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.XPATH, self.email_xpath)))
|
email_el = WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.XPATH, self.email_xpath)))
|
||||||
self.actions.move_to_element(email_el).click(email_el).perform()
|
self.actions.move_to_element(email_el).click(email_el).perform()
|
||||||
TypeInField(self.driver, self.email_xpath, self.configuration.username)
|
TypeInField(self.driver, self.email_xpath, self.configuration.username)
|
||||||
@ -35,7 +38,7 @@ class Bot:
|
|||||||
password_el.send_keys(Keys.RETURN)
|
password_el.send_keys(Keys.RETURN)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
profile = f'prof_{self.configuration.username}'
|
profile = f'prof_{self.configuration.username}'
|
||||||
|
|
||||||
if not os.path.exists(f'./Profiles/{profile}'):
|
if not os.path.exists(f'./Profiles/{profile}'):
|
||||||
@ -48,14 +51,14 @@ class Bot:
|
|||||||
|
|
||||||
logging.info('Logged in')
|
logging.info('Logged in')
|
||||||
|
|
||||||
Sheets_action = Sheets(self.driver, self.actions, self.configuration)
|
sheets_actions = Sheets(self.driver, self.actions, self.configuration)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
self.driver.get(self.categories[self.catindex])
|
self.driver.get(self.categories[self.catindex])
|
||||||
Sheets_list = Sheets_action.search()
|
sheets_list = sheets_actions.search()
|
||||||
if Sheets_list :
|
if sheets_list :
|
||||||
logging.info(f'Sheets n°{ self.index }')
|
logging.info(f'Sheets n°{ self.index }')
|
||||||
Sheets_action.watch(Sheets_list[0])
|
sheets_actions.watch(sheets_list[0])
|
||||||
self.index +=1
|
self.index +=1
|
||||||
wait_between(3,10)
|
wait_between(3,10)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -64,7 +64,13 @@ class Driver:
|
|||||||
return self.driver, self.action
|
return self.driver, self.action
|
||||||
|
|
||||||
def get_driver(self):
|
def get_driver(self):
|
||||||
|
"""
|
||||||
|
Get Driver
|
||||||
|
"""
|
||||||
return self.driver
|
return self.driver
|
||||||
|
|
||||||
def get_action(self):
|
def get_action(self):
|
||||||
|
"""
|
||||||
|
Get action
|
||||||
|
"""
|
||||||
return self.action
|
return self.action
|
||||||
|
|||||||
7
main.py
7
main.py
@ -10,12 +10,12 @@ from GlobalExamBot.driver import Driver
|
|||||||
from GlobalExamBot.bot import Bot
|
from GlobalExamBot.bot import Bot
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
"""
|
||||||
|
Main function
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
helpers = Helpers()
|
helpers = Helpers()
|
||||||
|
|
||||||
# Configuration of the logging library
|
|
||||||
helpers.logging_configuration()
|
|
||||||
|
|
||||||
# Load all configuration variables
|
# Load all configuration variables
|
||||||
config = helpers.load_configuration()
|
config = helpers.load_configuration()
|
||||||
|
|
||||||
@ -46,4 +46,5 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Helpers().logging_configuration()
|
||||||
main()
|
main()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user