45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
#!/usr/bin/python3
|
|
|
|
# Python imports
|
|
import sys, os, json
|
|
|
|
|
|
# Application imports
|
|
from core import Context
|
|
|
|
|
|
class Main(Context):
|
|
"""
|
|
This is the start that pulls the Context in and its mixins.
|
|
Load a command file from here or another class then call
|
|
respective method names and pass data as needed.
|
|
"""
|
|
def __init__(self, args):
|
|
"""
|
|
Initialize it all...
|
|
"""
|
|
super().__init__(args)
|
|
|
|
try:
|
|
|
|
with open(args.file) as f:
|
|
self.logger.debug("Opened command file...")
|
|
# Fill out your logic for parsing a command file...
|
|
# Then call the "call_method" methid to run a command against that logic.
|
|
pass
|
|
|
|
if "true" in args.persist.lower():
|
|
input("Press 'Enter' key to close the browser...")
|
|
|
|
except Exception as e:
|
|
self.logger.debug(e, exec_info=True)
|
|
|
|
self.driver.quit()
|
|
sys.exit(0)
|
|
|
|
|
|
def call_method(self, method_name, data = None):
|
|
mName = str(method_name)
|
|
method = getattr(self, mName, lambda data: "No valid key passed...\nkey= " + mName + "\nargs= " + data)
|
|
return method(data) if data else method()
|