static void Main(string[] args) { var(path, executeType) = GetArgParams(args); Initializer.Initialize( path, assemblyVersion: Assembly.GetExecutingAssembly().GetName().Version.ToString()); var context = new ContextForAutoTest(); var(testList, checkResult) = CheckPreExecution(executeType); if (!checkResult) { return; } try { using (IWebDriver driver = SelectBrowser(Parameters.ExtendedAutoTestSettings.BrowserType)) { driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(Parameters.ExtendedAutoTestSettings.TimeoutSeconds); TestAutomationOperate.LaunchBrowser(driver, Parameters.ExtendedAutoTestSettings); Thread.Sleep(500); Parameters.ExtendedAutoTestScenarios .Where((autoTestScenario, index) => testList.Contains(index)) .ForEach(autoTestScenario => { TestAutomationOperate.WriteResult( resultString: new AutoTestResult() { Description = autoTestScenario.CasesDescription }, ResultFileName: autoTestScenario.ResultFileName, resultInitial: true); TestAutomationOperate.WriteLog( logFileName: Parameters.ExtendedAutoTestSettings.LogFileName, logMessage: $"Start case:{ autoTestScenario.CaseName}", logInitial: true ); autoTestScenario.TestCases .SelectMany(testCase => Parameters.ExtendedAutoTestOperations .Where(testOperateion => testOperateion.TestPartsPath .StartsWith($"{testCase.TestPartsPath}\\{testCase.TestPartsName}"))) .ForEach(testOperation => TestAutomationExecute.ExecuteAutoTest( testOperation: testOperation, driver: driver, testSettings: Parameters.ExtendedAutoTestSettings, autoTestScenario: autoTestScenario)); }); TestAutomationOperate.WriteLog( logFileName: Parameters.ExtendedAutoTestSettings.LogFileName, logMessage: Displays.AutoTestFinished(context: context) ); Console.ReadKey(intercept: true); } } catch (NoSuchElementException ex) { TestAutomationOperate.WriteLog( logFileName: Parameters.ExtendedAutoTestSettings.LogFileName, logMessage: Displays.AutoTestHtmlError(context: context) ); TestAutomationOperate.WriteLog( logFileName: Parameters.ExtendedAutoTestSettings.LogFileName, logMessage: ex.Message ); Console.ReadKey(intercept: true); } catch (Exception ex) { TestAutomationOperate.WriteLog( logFileName: Parameters.ExtendedAutoTestSettings.LogFileName, logMessage: Displays.AutoTestOtherError(context: context) ); TestAutomationOperate.WriteLog( logFileName: Parameters.ExtendedAutoTestSettings.LogFileName, logMessage: ex.Message ); Console.ReadKey(intercept: true); } }