コード例 #1
0
        public static void writeResultToExcel(string _res, string _msg, int _row, string _filename, int _colNumber, int _sheet)
        {
            Excel.Application x1 = new Excel.Application();
            ExplicitWaiting.waitForTime(2000);
            bool _resDirExists = Directory.Exists(_rootPath);

            if (_resDirExists)
            {
                bool _fileExists = System.IO.File.Exists(_rootPath + _filename + ".xlsx");
                if (_fileExists)
                {
                    Excel.Workbook   _workbook  = x1.Workbooks.Open(_rootPath + _filename + ".xlsx");
                    Excel._Worksheet _worksheet = _workbook.Sheets[_sheet];
                    Excel.Range      _range     = _worksheet.UsedRange;
                    _range.Cells[_row, 5] = _res;
                    _range.Cells[_row, 6] = _msg;
                    _workbook.Save();
                    _workbook.Close();
                }
                else
                {
                    Console.WriteLine("Output file does not exists........");
                }
            }
            else
            {
                DirectoryInfo _newDir = Directory.CreateDirectory(_rootPath);
                //ToDo code for copy file from backup directory.
            }
        }
コード例 #2
0
        public static void SelectModelPhase(string _model)
        {
            switch (_model)
            {
            case "Phase 1(DMA)":
                //BrowserConfig._driver.FindElement(By.XPath(ObjectIdentifiers._pstt)).Click();
                break;

            case "Phase 2(DMA + Compression)":
                ExplicitWaiting.waitForTime(3000);
                BrowserConfig._driver.FindElement(By.XPath(ObjectIdentifiers._phase1)).Click();
                ExplicitWaiting.waitForTime(3000);
                BrowserConfig._driver.FindElement(By.XPath(ObjectIdentifiers._phase2)).Click();
                break;

            case "Phase 3(DMA + Compression + Tensile)":
                BrowserConfig._driver.FindElement(By.XPath(ObjectIdentifiers._phase1)).Click();
                BrowserConfig._driver.FindElement(By.XPath(ObjectIdentifiers._phase3)).Click();
                break;
            }
        }