Best Python code snippet using toolium_python
driver_manager.py
Source:driver_manager.py
...126 try:127 if driver_wrapper.config.getboolean_optional('Server', 'logs_enabled') or not test_passed:128 from arc.contrib.utilities import get_valid_filename129 name = get_valid_filename(log_name.format(test_name, driver_index))130 Selenoid(driver_wrapper).download_session_log(name)131 except Exception as exc:132 driver_wrapper.logger.warn(f"Error downloading GGR logs: {exc}")133 driver_index += 1134 @staticmethod135 def get_configured_value(system_property_name, specific_value, default_value):136 try:137 return os.environ[system_property_name]138 except KeyError:139 return specific_value if specific_value else default_value140 @classmethod141 def configure_common_directories(cls, tc_config_files):142 if cls.config_directory is None:143 config_directory = cls.get_configured_value('Config_directory', tc_config_files.config_directory, 'conf')144 prop_filenames = cls.get_configured_value('Config_prop_filenames',...
log.py
Source:log.py
...106 return send_file(os.path.join(log_file_path, 'system_logs'), as_attachment=True)107# This route will prompt a file download108@log.route('/download_session_log')109@login_required110def download_session_log():111 return send_file(get_log_directory() + request.args.get('file_path'), as_attachment=True)112@log.route('/api/download_session_logs', methods=['POST'])113@login_required114def api_download_session_logs():115 file_list = request.args.getlist('file_list[]')[0].split(',')116 return download_session_logs(file_list, current_user.username)117@log.route('/api/get_session_log_file_diff')118@login_required119def api_get_session_log_file_diff():120 diff_file_path = request.args.get("diff_file_path")121 if is_empty(diff_file_path):122 return jsonify({'status': 'diff file is missing.'})123 file_diff_contents = ''124 with io.open(os.path.join(get_log_directory(), diff_file_path), "rt", encoding='latin-1') as fo:...
selenoid.py
Source:selenoid.py
...83 video_url = f"{self.server_url}/video/{filename}"84 if self.browser_remote:85 self.__download_file(video_url, path_file, timeout)86 self.__remove_file(video_url)87 def download_session_log(self, scenario_name, timeout=5):88 if (self.driver_wrapper.get_driver_platform().lower() != 'linux' or89 not self.driver_wrapper.config.getboolean_optional('Capabilities', 'enableLog')):90 return91 path_file = os.path.join(self.logs_directory, '%s_ggr.%s' % (scenario_name, constants.SEL_LOG_EXTENSION))92 if self.driver_wrapper.server_type == 'selenoid':93 filename = '%s.%s' % (self.session_id, constants.SEL_LOG_EXTENSION)94 else:95 filename = self.session_id96 logs_url = f"{self.server_url}/logs/{filename}"97 if self.browser_remote:98 self.__download_file(logs_url, path_file, timeout)99 self.__remove_file(logs_url)100 def download_file(self, filename, timeout=5):101 path_file = os.path.join(self.output_directory, constants.SEL_DOWNLOADS_PATH, self.session_id[-8:], filename)...
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!!