private void AddFilesToConvert(String FileName) { // Add File for Consumption File SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); btnAddFile = window.Get <TestStack.White.UIItems.Button>("btnAddFile"); window.WaitWhileBusy(); btnAddFile.Click(); window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); // Set File which one is to be process SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); txtSetFileName = window.Get <TestStack.White.UIItems.TextBox>("1148"); window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); txtSetFileName.SetValue(FileName); window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); // Click Open Button SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); btnOpen = window.Get <TestStack.White.UIItems.Button>("1"); window.WaitWhileBusy(); btnOpen.Click(); window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); }
public void SetUp() { leraApp = TestStack.White.Application.Launch("LeraForm.exe"); mainWindow = leraApp.GetWindow("myWin"); btn = mainWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("button1")); label = mainWindow.Get <TestStack.White.UIItems.Label>(SearchCriteria.ByAutomationId("label1")); }
public static void SelectOutputsEnableButton() { Button _button = AWGUI.currentUIControlPanel.Get <Button>(SearchCriteria.ByAutomationId(AWGUI.FGenChannelOutputEnableButton)); Assert.IsNotNull(_button); Assert.IsTrue(_button.Enabled); _button.Click(); }
public static void FGenChannelOutputEnableButtonShouldBe(string expectedState) { string buttonId = AWGUI.FGenChannelOutputEnableButton; Button _button = AWGUI.currentUIControlPanel.Get <Button>(SearchCriteria.ByAutomationId(buttonId)); Assert.IsNotNull(_button); //The ToggleState property returns a Ucase value, so we have to convert Assert.AreEqual(expectedState, _button.State.ToString().ToLower()); }
protected void btnOpenWndw_Click(object sender, EventArgs e) { try { KillRDPSession(); TimeBoundAccessRequest tbar = Session["TBAR"] as TimeBoundAccessRequest; CoreAppXmlConfiguration.Instance.BusyTimeout = 20000; Application app = TestStack.White.Application.Launch(@"E:\Software\TeamViewer_Setup.exe"); TestStack.White.UIItems.WindowItems.Window tvWindow = GetTeamViewerWindow(app); TestStack.White.UIItems.RadioButton runOnceCheckBox = tvWindow?.Items.FirstOrDefault(w => w.Name.ToUpper().Contains("ONE TIME")) as TestStack.White.UIItems.RadioButton; runOnceCheckBox.Select(); TestStack.White.UIItems.Button button = tvWindow?.Items.FirstOrDefault(w => w.Name.ToUpper().Contains("ACCEPT")) as TestStack.White.UIItems.Button; button.Click(); tvWindow = GetTeamViewerWindow(app); //give tv some seconds to intialize Thread.Sleep(new TimeSpan(0, 0, 10)); //Takes a screenshot of the entire desktop, and saves it to disk tvWindow.Focus(TestStack.White.UIItems.WindowItems.DisplayState.Maximized); Bitmap bitmap = Desktop.CaptureScreenshot(); string ImageName = DateTime.Now.Ticks.ToString() + ".jpg"; String saveImagePath = Server.MapPath("Images/") + ImageName; bitmap.Save(saveImagePath); tvImageDesktop.ImageUrl = "Images/" + ImageName; Session["APP"] = app; imgDiv.Visible = true; processingDiv.Visible = false; btnOpenWndw.Text = "RE-START THIS SESSION"; Task.Factory.StartNew(() => { DateTime maxDate = tbar.StartTime.AddMinutes(tbar.DurationInMinutes); DateTime currentDate = DateTime.Now; int minutesLeft = ((int)maxDate.Subtract(currentDate).TotalMinutes) + 1;//add an extra minute for network latency Thread.Sleep(new TimeSpan(0, minutesLeft + AnyAdditionalMinutes, 0)); KillRDPSession(); //string msg = "SESSION HAS EXPIRED"; //Master.ErrorMessage = msg; return; }); } catch (Exception ex) { //Show Error Message string msg = "ERROR:" + ex.Message; Master.ErrorMessage = msg; return; } }
public void ThenIStartLabWareAndProcessedResults() { System.Media.SystemSounds.Beep.Play(); //System.Media.SoundPlayer sp = new System.Media.SoundPlayer(@"D:\STalkToME.wav"); //sp.Play(); application = TestStack.White.Application.Launch("\\\\tst10-lwapp.medlinx.corp\\LW-LIMS-V6\\lw-lims.lnk"); Window mainWindow = application.GetWindow("LabWare LIMS"); TestStack.White.UIItems.Button btnbuttonintoolbar = mainWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByText("Log into LIMS")); btnbuttonintoolbar.Click(); Window logInWindow = application.GetWindow("Please Log In"); TestStack.White.UIItems.TextBox loginField = logInWindow.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("101")); loginField.BulkText = "testopr"; TestStack.White.UIItems.TextBox passField = logInWindow.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("102")); passField.BulkText = "123456"; TestStack.White.UIItems.Button okButton = logInWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("104")); okButton.Click(); Window locationWin = application.GetWindow("Выберите расположение"); TestStack.White.UIItems.ListViewRow chooseSPB = locationWin.Get <TestStack.White.UIItems.ListViewRow>(SearchCriteria.ByText("HELIX-SPB")); //= locationWin.Get<TestStack.White.UIItems.TextBox>(SearchCriteria.ByClassName("HELIX-SPB")); chooseSPB.Click(); TestStack.White.UIItems.Button okLocationButton = locationWin.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("104")); okLocationButton.Click(); Window windowAfterLogin = Desktop.Instance.Windows().Find(obj => obj.Title.Contains("User TESTOPR logged")); var menuBar = windowAfterLogin.Get <MenuBar>(SearchCriteria.ByText("Приложение")); var menu = menuBar.MenuItem("Configure", "System", "Client..."); menu.Click(); Window passworDialogWindow = application.GetWindow("Password Dialog"); TestStack.White.UIItems.Button okButtonInPasswordDialog = passworDialogWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("102")); okButtonInPasswordDialog.Click(); Window configurationManagerWindow = application.GetWindow("Configuration Manager"); TestStack.White.UIItems.Button okButtonInConfigurationManager = configurationManagerWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("102")); okButtonInConfigurationManager.Click(); System.Threading.Thread.Sleep(3000); application.Close(); }
//This method select perticular button on the page public static bool Click(pscWindow window, string elementid) { try { Console.WriteLine("Trying to access the element using automation id"); try { Button button = window.Get <Button>(SearchCriteria.ByAutomationId(elementid)); button.Click(); return(true); } catch (Exception) { try { Console.WriteLine("Trying to access the element using Name of element"); Button button = window.Get <Button>(SearchCriteria.ByText(elementid)); button.Click(); return(true); } catch (Exception) { try { Console.WriteLine("Trying to access the element using ClassName id"); Button button = window.Get <Button>(SearchCriteria.ByClassName(elementid)); button.Click(); return(true); } catch (Exception) { Console.WriteLine("Not able to find out the element id"); return(false); } } } } catch (Exception) { Console.WriteLine("Not able to click on button"); return(false); } }
public void mainWindowTest() { setupapp(); Window mainWindow = application.GetWindow("MainWindow"); TestStack.White.UIItems.Button btnbuttonintoolbar = mainWindow.Get <White.UIItems.Button>(SearchCriteria.ByText("Button in toolbar")); btnbuttonintoolbar.Click(); Thread.Sleep(2000); TestStack.White.UIItems.TabItems.TabPage tabList = mainWindow.Get <White.UIItems.TabItems.TabPage>(SearchCriteria.ByText("List Controls")); tabList.Click(); Thread.Sleep(2000); TestStack.White.UIItems.TabItems.TabPage tabInput = mainWindow.Get <White.UIItems.TabItems.TabPage>(SearchCriteria.ByText("Input Controls")); tabInput.Click(); Thread.Sleep(2000); TestStack.White.UIItems.TabItems.TabPage tabOther = mainWindow.Get <White.UIItems.TabItems.TabPage>(SearchCriteria.ByText("Other Controls")); tabOther.Click(); Thread.Sleep(2000); TestStack.White.UIItems.TabItems.TabPage tabData = mainWindow.Get <White.UIItems.TabItems.TabPage>(SearchCriteria.ByText("Data Grid")); tabData.Click(); Thread.Sleep(2000); tabList.Click(); Thread.Sleep(2000); }
static void Main(string[] args) { for (int i = 0; i < Convert.ToInt32(args[1]); i++) { StreamWriter file2 = new StreamWriter(@"e:\RunningTimeWhiteLogin.txt", true); Stopwatch stopwatch = Stopwatch.StartNew(); //creates and start the instance of Stopwatch var psi = new ProcessStartInfo(@"C:\\Users\\pth\\AppData\\Local\\Personify\\Omni\\Personify.exe"); TestStack.White.Application app = TestStack.White.Application.AttachOrLaunch(psi); int numWaits = 0; Window window; do { Console.WriteLine("\n Looking for Chat application..."); // Find window with title "Personify" window = app.GetWindow("Personify", TestStack.White.Factory.InitializeOption.NoCache); ++numWaits; Thread.Sleep(100); } while (window == null && numWaits < 50); Assert.IsNotNull(window); TestStack.White.UIItems.TextBox username = window.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("Username")); TestStack.White.UIItems.TextBox password = window.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("Password")); if (username == null || password == null) { Assert.Fail("!!Can not find any textbox"); } AutomationElement aeTemp = TreeWalker.ControlViewWalker.GetNextSibling(password.AutomationElement); // Input valid nxchattest1 user account to sign in. AutomationElement aeSignInButton = TreeWalker.ControlViewWalker.GetNextSibling(aeTemp); TestStack.White.UIItems.Button signIn = new TestStack.White.UIItems.Button(aeSignInButton, window.ActionListener); username.BulkText = ""; password.BulkText = ""; signIn.Click(); Thread.Sleep(1000); username.BulkText = "*****@*****.**"; password.BulkText = "123456"; signIn.Click(); Thread.Sleep(2000); // Waiting for Chat Deck Window display numWaits = 0; do { Console.WriteLine("\n Looking for Chat Deck..."); window = app.GetWindow("Home", TestStack.White.Factory.InitializeOption.NoCache); ++numWaits; Thread.Sleep(100); } while (window == null && numWaits < 50); //TestStack.White.UIItems.TextBox texttemp = window.Get<TestStack.White.UIItems.TextBox>(SearchCriteria.ByText("Create an immersive recording with your persona and content on screen.")); TestStack.White.UIItems.Label texttemp = window.Get <TestStack.White.UIItems.Label>(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, "Create an immersive recording with your persona and content on screen.")); AutomationElement aemenu = TreeWalker.ControlViewWalker.GetNextSibling(texttemp.AutomationElement); TestStack.White.UIItems.Button menubtn = new TestStack.White.UIItems.Button(aemenu, window.ActionListener); menubtn.Toggle(); TestStack.White.UIItems.MenuItems.Menu signout = window.Get <TestStack.White.UIItems.MenuItems.Menu>(SearchCriteria.ByText("Sign out")); signout.Click(); app.Kill(); stopwatch.Stop(); file2.WriteLine(stopwatch.ElapsedMilliseconds + " miliseconds"); file2.Close(); } }
//PHunter 10/24/2012 /// <summary> /// Cleans up any remaining dialogs at the start and end of each scenario. Captures a screenshot if dialog is found. /// </summary> public void CleanupDialogs() { if (AwgSetupSteps.IgnoreUi) { return; } //PWH - none of this next block seems to have been used. The Rectangle Bounds call seems to be the source of the White "out of bounds" warning //Needed for screen captures Rectangle bounds = Screen.GetBounds(Screen.GetBounds(Point.Empty)); string logFile = GetLogFileName(); //Check to see if the app is still running Console.WriteLine("Instantiating 'application' object - looking for running AWG70K.exe process"); Process[] application = Process.GetProcessesByName(AWGUI.ProcessName); if (application.Length != 0) //if the process is not exited... { //List of all the modal windows that belong to the window. Console.WriteLine("Listing modal windows under the AWG70K.exe process"); List <Window> modalWindows = new List <Window>(); bool validWindow = true; try { modalWindows = AWGUI.currentMainWindow.ModalWindows(); } catch (Exception) { Console.WriteLine("Exception for modalWindows was thrown and ignored"); validWindow = false; } if (validWindow) { //Count the number of modal windows Console.WriteLine("The number of modal widows found was: " + modalWindows.Count); if (modalWindows.Count > 0) { //Then for each modal window, try and close it for (int i = 0; i <= modalWindows.Count - 1; i++) { //Get the title bar text of the next window in the list string dialogTitlebar = modalWindows[i].Title.ToString(); Console.WriteLine("Handling the " + dialogTitlebar + " dialog"); //Switch to the handler for each defined dialog type switch (dialogTitlebar) { //Close any AWG MESSAGE dialogs case "AWG Message": Window awgMessageDialog = AWGUI.currentMainWindow.ModalWindow(SearchCriteria.ByText("AWG Message")); Button MsgOKButton = awgMessageDialog.Get <Button>(SearchCriteria.ByText("OK")); Delay(1); Assert.IsNotNull(MsgOKButton, "OK button was not found in the AWG Message dialog"); MsgOKButton.Click(); //Click on OK button in Error dialog break; //Close any UNSAVED ASSETS dialogs case "Unsaved Assets": Console.WriteLine("Debug"); Window unsavedAssetsDialog = AWGUI.currentMainWindow.ModalWindow(SearchCriteria.ByText("Unsaved Assets")); Button dontSave = unsavedAssetsDialog.Get <Button>(SearchCriteria.ByText("Don't Save")); Delay(1); Assert.IsNotNull(dontSave, "Don't Save button was not found in Unsaved Assets dialog"); dontSave.Click(); break; //Close any UNEXPECTED ERROR dialogs case "Unexpected Error": //Call Function to capture the screen shot of error message CaptureImage(Point.Empty, Point.Empty, bounds, logFile, ""); Delay(5); // Delay to click the button after the screen capture is done Window unexpectedErrorDialog = AWGUI.currentMainWindow.ModalWindow(SearchCriteria.ByText("Unexpected Error")); Button okButton = unexpectedErrorDialog.Get <Button>(SearchCriteria.ByText("OK")); Delay(1); Assert.IsNotNull(okButton, "OK button was not found in Unexpected Error dialog"); okButton.Click(); //Kill the test run Console.WriteLine( "AWG application threw an Unexpected Errror and crashed. A screen capture was made."); KillMSTest(); break; //Close any HELP dialogs case "Arbitrary Waveform Generator User Help": Window helpDialog = AWGUI.currentMainWindow.ModalWindow( SearchCriteria.ByText("Arbitrary Waveform Generator User Help")); Button helpCloseButton = helpDialog.Get <Button>(SearchCriteria.ByAutomationId("Close")); Delay(1); Assert.IsNotNull(helpCloseButton, "Close button was not found in Help dialog"); helpCloseButton.Click(); break; //Wait for any PROGRESS dialogs case "Progress": // If the progress dialog is found, it takes 5 seconds or so to clear. This is typical // when the operation was a change to the AWG mode (NORM, CAL, DIAG). // TODO: PWH - once the Progress dialog has been detected, it would be better to see if it is still there once you drop to the handler and then actually handle the window, rather than just waiting for it to go away. Delay(6); break; case "Diagnostics and Calibration": // Do nothing, Diag and Cal dialog is cleared with the reset at the start of a new scenario break; case "C:\\Windows\\system32\\cmd.exe": // Do nothing, this is the test runner command window break; case "": // Do nothing, if empty string is captured break; // If the dialog is still not recognized, capture a screen shot to c:\temp and put an error in the log default: // Call Function to capture the screen shot of error message Console.WriteLine("An unknown dialog ('" + dialogTitlebar + "')was found in Utilities.CleanUpDialogs() function while cleaning up after a scenario. A screen capture was made."); CaptureImage(Point.Empty, Point.Empty, bounds, logFile, ""); Delay(5); // Delay to click the button until after the screen capture is done Assert.Fail("An unknown dialog ('" + dialogTitlebar + "')was found in Utilities.CleanUpDialogs() function while cleaning up after a scenario. A screen capture was made."); break; } } } } } else //The app is not running, capture a screen shot to c:\temp and put an error in the log { //Call Function to capture the screen shot of error message CaptureImage(Point.Empty, Point.Empty, bounds, logFile, ""); Delay(5); // Delay to click the button until after the screen capture is done Console.WriteLine( "The AWG application did not appear to be running in Utilities.CleanUpDialogs() function while cleaning up after a scenario. A screen capture was made."); //Kill the test run KillMSTest(); } }
private Boolean ConvertPDFToExcel(Dictionary <string, string> ProcessInfo) { /* * USE FULL LINKS FOR TestStack * https://github.com/TestStack/White * http://teststackwhite.readthedocs.io/en/latest/ * http://teststackwhite.readthedocs.io/en/latest/UIItems/#controltype-to-uiitem-mapping-for-primary-uiitems * http://www.dreamincode.net/forums/topic/322108-c%23-teststackwhite-for-beginners/ (Examples) * */ string windowslist = "Windows Count is :"; processList.Add(GetFormattedText(LogType.Info, "PDF To Excel Conversion Process Initialization")); Boolean completedStatus = false; String tempStr = ""; try { File.WriteAllText(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + StatusFile, "Temp=0,Status=Convert Process Initiated"); processList.Add(GetFormattedText(LogType.Info, "Convert Process Initiated")); pdfToExcelApp = TestStack.White.Application.Launch(AppDefaultDir + PDFConverterAppPath); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); processList.Add(GetFormattedText(LogType.Info, "Application Launched")); List <Window> allWindows = pdfToExcelApp.GetWindows(); windowslist = windowslist + allWindows.Count(); foreach (Window aWindow in allWindows) { windowslist = windowslist + "- Window Name is :" + aWindow.Title; } windowslist = windowslist + " Window Title is " + pdfToExcelApp.Process.MainWindowTitle; processList.Add(GetFormattedText(LogType.Info, windowslist)); window = pdfToExcelApp.GetWindow(SearchCriteria.ByText("PDFdu PDF To Excel (Registered) v1.3"), InitializeOption.NoCache); window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); //window.LogStructure(); // To Display all components list with AutomationId in Window. processList.Add(GetFormattedText(LogType.Info, "Window Detected")); File.WriteAllText(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + StatusFile, "Temp=0,Status=Window Detected"); // Merge multiple worksheets into a single worksheet TestStack.White.UIItems.CheckBox chkMergeMultiple = window.Get <TestStack.White.UIItems.CheckBox>("chkCombine"); window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); chkMergeMultiple.Checked = true; window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); // Show Output folder when done TestStack.White.UIItems.CheckBox chkOpen = window.Get <TestStack.White.UIItems.CheckBox>("chkOpen"); window.WaitWhileBusy(); chkOpen.Checked = false; window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); // Original Folder TestStack.White.UIItems.RadioButton rdoSaveOld = window.Get <TestStack.White.UIItems.RadioButton>("rdoSaveOld"); window.WaitWhileBusy(); rdoSaveOld.IsSelected = true; window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); TestStack.White.UIItems.RadioButton rdoXlsx = window.Get <TestStack.White.UIItems.RadioButton>("rdoXlsx"); window.WaitWhileBusy(); rdoXlsx.IsSelected = true; window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); // Custom File Name TestStack.White.UIItems.CheckBox chkCustomFileName = window.Get <TestStack.White.UIItems.CheckBox>("chkFileName"); window.WaitWhileBusy(); chkCustomFileName.Checked = false; window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); // Add file name prefix TestStack.White.UIItems.CheckBox chkBeforeName = window.Get <TestStack.White.UIItems.CheckBox>("chkBeforeName"); window.WaitWhileBusy(); chkBeforeName.Checked = false; window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); // Add file name suffix TestStack.White.UIItems.CheckBox chkAfterName = window.Get <TestStack.White.UIItems.CheckBox>("chkAfterName"); window.WaitWhileBusy(); chkAfterName.Checked = false; window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); AddFilesToConvert(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + ProcessInfo["CON"]); processList.Add(GetFormattedText(LogType.Info, "Consumption File Assigned")); window.WaitWhileBusy(); AddFilesToConvert(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + ProcessInfo["GEN"]); processList.Add(GetFormattedText(LogType.Info, "Generation File Assigned")); window.WaitWhileBusy(); AddFilesToConvert(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + ProcessInfo["TSC"]); processList.Add(GetFormattedText(LogType.Info, "Time Slot File Assigned")); window.WaitWhileBusy(); AddFilesToConvert(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + ProcessInfo["MCON"]); processList.Add(GetFormattedText(LogType.Info, "Meter Consumption File Assigned")); window.WaitWhileBusy(); AddFilesToConvert(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + ProcessInfo["OAB"]); processList.Add(GetFormattedText(LogType.Info, "Open Access Bill File Assigned")); window.WaitWhileBusy(); processList.Add(GetFormattedText(LogType.Info, "Convert Processing Initiated......")); // Now Start Convert PDF to Excel TestStack.White.UIItems.Button btnMakePDF = window.Get <TestStack.White.UIItems.Button>("btnMakePDF"); window.WaitWhileBusy(); btnMakePDF.Click(); window.WaitWhileBusy(); processList.Add(GetFormattedText(LogType.Info, "Convert Processing Started......")); // Display Progress Window TestStack.White.UIItems.Label lblDoing = window.Get <TestStack.White.UIItems.Label>(SearchCriteria.ByAutomationId("lblDoing")); window.WaitWhileBusy(); String currProgressText = ""; do { processList.Add(GetFormattedText(LogType.Info, "Progress Text : " + lblDoing.Text)); if (!currProgressText.Equals(lblDoing.Text)) { if (lblDoing.Text.Contains("1/5")) { tempStr = "CONS"; } else if (lblDoing.Text.Contains("2/5")) { tempStr = "GEN"; } else if (lblDoing.Text.Contains("3/5")) { tempStr = "TSC"; } else if (lblDoing.Text.Contains("4/5")) { tempStr = "MCON"; } else if (lblDoing.Text.Contains("5/5")) { tempStr = "OAB"; } File.WriteAllText(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + StatusFile, String.Format("State={0},Status={1}", tempStr, lblDoing.Text)); } SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); Thread.Sleep(500); } while (!lblDoing.Text.Contains("Please Wait ...")); window.WaitWhileBusy(); SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); completedStatus = true; File.WriteAllText(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + StatusFile, String.Format("State={0},Status={1}", "Completed", "Completed")); processList.Add(GetFormattedText(LogType.Info, "Convert Process Completed")); // Display Message Dialog after Process completed.. SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle); window.WaitWhileBusy(); TestStack.White.UIItems.Button btnCompleted = window.Get <TestStack.White.UIItems.Button>("2"); window.WaitWhileBusy(); btnCompleted.Click(); pdfToExcelApp.Kill(); processList.Add(GetFormattedText(LogType.Info, "Convert PDF To Closed")); return(true); } catch (Exception convertPDFToExcelExp) { var annotatedException = new Exception("ConvertPDFToExcel-" + windowslist, convertPDFToExcelExp); processList.Add(GetFormattedText(LogType.Error, "Unable to convert PDF To Excel due to " + convertPDFToExcelExp.ToString())); if (!completedStatus) // Some times exception raised after file processing completed.. like Unable to find Completed button { File.WriteAllText(AppDefaultDir + UploadFileDir + ProcessInfo["DIR"] + "\\" + StatusFile, String.Format("State={0},Status={1}", tempStr, "Failed")); } if (pdfToExcelApp != null) { pdfToExcelApp.Kill(); } return(false); } }