def debugTestMain(folderpath, dirname): logging.info(" setting config...") config = SeleniumConfiguration(Browser.FireFox, "http://140.112.42.145:2000/demo/nothing/main.html") config.set_max_depth(1) config.set_max_length(5) config.set_trace_amount(1) config.set_max_states(100) config.set_folderpath(folderpath) config.set_dirname(dirname) config.set_automata_fname('automata.json') config.set_traces_fname('traces.json') config.set_frame_tags(['iframe']) config.set_dom_inside_iframe(True) config.set_simple_clickable_tags() config.set_simple_inputs_tags() config.set_simple_normalizers() logging.info(" setting executor...") executor = SeleniumExecutor(config.get_browserID(), config.get_url()) logging.info(" setting crawler...") automata = Automata(config) databank = InlineDataBank("140.112.42.145:2000", "jeff", "zj4bj3jo37788", "test") algorithm = MonkeyCrawler() #DFScrawler() crawler = SeleniumCrawler(config, executor, automata, databank, algorithm) logging.info(" crawler start run...") crawler.run_algorithm() logging.info(" end! save automata...") algorithm.save_traces() automata.save_automata(config.get_automata_fname()) Visualizer.generate_html('web', os.path.join(config.get_path('root'), config.get_automata_fname())) config.save_config('config.json')
def CBTestMain(folderpath, dirname,web_submit_id): logging.info(" Type: Cross Browser Testing") logging.info(" connect to mysql") print("") print("connect to sql") databank = MysqlDataBank("localhost", "root", "", "test") url, deep, time, b1, b2 = databank.get_websubmit(int(web_submit_id)) basic_browserID = str(b1) other_browserID = str(b2) depth = int(deep) logging.info(" A new CBT begings...") logging.info(" setting config...") config = SeleniumConfiguration(int(basic_browserID),int(other_browserID), url) # max 3 config.set_max_depth(int(depth)) # max 3 config.set_max_length(int(depth)) # should be 1 config.set_trace_amount(1) # should be 100 no use? config.set_max_states(5) config.set_folderpath(folderpath) config.set_dirname(dirname) config.set_automata_fname('automata.json') config.set_traces_fname('traces.json') #config.set_frame_tags(['iframe']) config.set_dom_inside_iframe(True) config.set_simple_clickable_tags() config.set_simple_inputs_tags() config.set_simple_normalizers() logging.info(" setting executor...") #nothing here executor = CBTExecutor(config.get_browserID(), config.get_url()) logging.info(" setting crawler...") automata = Automata(config) #databank = InlineDataBank("140.112.42.145:2000", "jeff", "zj4bj3jo37788", "test") databank = InlineDataBank("localhost", "B00901138", "R124249166", "test") print('start Cross Browser Testing...') #acually it's CBT algorithm algorithm = CBTCrawler(int(other_browserID),url) crawler = SeleniumCrawler(config, executor, automata, databank, algorithm) logging.info(" crawler start runing...") crawler.run_algorithm() print(" end! save automata...") logging.info(" end! save automata...") algorithm.save_traces() automata.save_automata(config.get_automata_fname()) Visualizer.generate_html('web', os.path.join(config.get_path('root'), config.get_automata_fname())) config.save_config('config.json')