Best Python code snippet using SeleniumBase
master_qa.py
Source:master_qa.py
...26 self.START_IN_FULL_SCREEN_MODE = (27 settings.MASTERQA_START_IN_FULL_SCREEN_MODE)28 self.MAX_IDLE_TIME_BEFORE_QUIT = (29 settings.MASTERQA_MAX_IDLE_TIME_BEFORE_QUIT)30 self.__manual_check_setup()31 if self.headless:32 self.auto_close_results_page = True33 if self.START_IN_FULL_SCREEN_MODE:34 self.maximize_window()35 def verify(self, *args):36 warn_msg = "\nWARNING: MasterQA skips manual checks in headless mode!"37 self.check_count += 138 if self.headless:39 if self.check_count == 1:40 print(warn_msg)41 return42 # This is where the magic happens43 self.__manual_page_check(*args)44 def auto_close_results(self):45 ''' If this method is called, the results page will automatically close46 at the end of the test run, rather than waiting on the user to close47 the results page manually.48 '''49 self.auto_close_results_page = True50 def tearDown(self):51 if self.headless and self.check_count > 0:52 print("WARNING: %s manual checks were skipped!" % self.check_count)53 if sys.exc_info()[1]:54 self.__add_failure(sys.exc_info()[1])55 self.__process_manual_check_results(self.auto_close_results_page)56 super(MasterQA, self).tearDown()57 ####################58 def __get_timestamp(self):59 return str(int(time.time() * 1000))60 def __manual_check_setup(self):61 self.manual_check_count = 062 self.manual_check_successes = 063 self.incomplete_runs = 064 self.page_results_list = []65 self.__clear_out_old_logs(archive_past_runs=False)66 def __clear_out_old_logs(67 self, archive_past_runs=True, get_log_folder=False):68 abs_path = os.path.abspath('.')69 file_path = abs_path + "/%s" % self.LATEST_REPORT_DIR70 if not os.path.exists(file_path):71 os.makedirs(file_path)72 if archive_past_runs:73 archive_timestamp = int(time.time())74 if not os.path.exists("%s/../%s/" % (file_path, self.ARCHIVE_DIR)):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!