コード例 #1
0
ファイル: MenuProxies.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Closes the application via the 'File - Exit' menu.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <exception cref="RegressionTestFailedException">
        ///     Thrown if the 'File - Exit' menu could not be invoked for some reason.
        /// </exception>
        public static void CloseApplicationViaFileExitMenuItem(Application application, Log log)
        {
            const string prefix = "Menus - Close application via File menu";
            var menu = GetMainMenu(application, log);
            if (menu == null)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to get the main menu.");
            }

            var fileMenuSearchCriteria = SearchCriteria.ByAutomationId(MainMenuAutomationIds.File);
            var exitSearchCriteria = SearchCriteria.ByAutomationId(MainMenuAutomationIds.FileExit);
            var exitMenu = Retry.Times(() => menu.MenuItemBy(fileMenuSearchCriteria, exitSearchCriteria));
            if (exitMenu == null)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to get the 'File - Exit' menu.");
            }

            try
            {
                exitMenu.Click();
                application.Process.WaitForExit(Constants.ShutdownWaitTimeInMilliSeconds());
            }
            catch (Exception e)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to click the 'File - Exit' menu item.", e);
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Process proc = Process.GetProcessesByName("QBW32").FirstOrDefault();

            TestStack.White.Application app = TestStack.White.Application.Attach(proc);

            SearchCriteria sc = SearchCriteria.ByClassName("MauiFrame");

            var mainWindow = app.GetWindow(sc, InitializeOption.WithCache);

            mainWindow.Focus();

            SendKeys.SendWait("%+{y}{P}{U}");

            Thread.Sleep(3000);

            var modelWindows = mainWindow.ModalWindows()
                               .Where(w => w.Title == "Enter Payroll Information")
                               .FirstOrDefault();

            //var table = GetTableElement(modelWindows);

            //AutomationElement elm = modelWindows
            //    .GetElement(SearchCriteria.ByControlType(ControlType.HeaderItem));

            //SearchCriteria tableSearch = SearchCriteria.ByControlType(ControlType.HeaderItem);


            //var table = modelWindows.Get<TestStack.White.UIItems.TableItems.TableHeader>(tableSearch);

            var x = 0;
        }
コード例 #3
0
ファイル: MainWindow.cs プロジェクト: luislasonbra/CTRTools-1
        public MainWindow(string name = "Powrvw-V")
        {
            var pvProc = Process.GetProcessesByName("Powrvw-V");

            if (pvProc.Length != 1)
            {
                throw new Exception("Please open exactly one pv process");
            }

            app        = w.Application.Attach(pvProc[0]);
            appProcess = pvProc[0];

            config   = new PVConfig(appProcess.MainModule.FileName);
            dbFolder = config.Get(PVConfig.Keys.DatabaseFolder);

            if (dbFolder == null || !Directory.Exists(dbFolder))
            {
                throw new Exception("Cannot get db folder of " + dbFolder);
            }

            dataBases = GetDataBases(dbFolder);

            var t = Window.Title.Split(new string[] { " - " }, StringSplitOptions.None);

            try
            {
                currDatabase = (from db in dataBases
                                where db.name == t[1] && db.description == t[2]
                                select db).ToList()[0];
            }
            catch (ArgumentOutOfRangeException)
            {
                throw new Exception("Cannot determine current database");
            }
        }
        public static void ClassInit(TestContext context)
        {
            var applicationPath = "WhiteTest.exe";

            application = Application.Launch(applicationPath);
            window = application.GetWindow("MainWindow", InitializeOption.NoCache);
        }
コード例 #5
0
ファイル: WinFormTest.cs プロジェクト: johnmensen/TradeSharp
        /// <summary>
        /// Инициализация и запуск 'пустого' прилжения для тестирования
        /// </summary>
        /// <returns></returns>
        public bool InitEmptyApplication(string formName)
        {
            formName = formName.Replace(" ", "");

            // найти приложение - пустышку
            var fullPath = CheckAllIniFolders(TestAppExeName);
            if (string.IsNullOrEmpty(fullPath))
                return false;

            try
            {
                Logger.Debug(string.Format("Поиск каталога {0} и попытка запуска 'пустого' приложения", fullPath));
                //var processStartInfo = new ProcessStartInfo(fullPath, formName);
                //application = Application.Launch(processStartInfo);
                var proc = new Process { StartInfo = { FileName = fullPath, Arguments = formName } };
                proc.Start();
                Logger.InfoFormat("Spawned proc ID: {0}, own proc ID: {1}",
                                  proc.Id, Process.GetCurrentProcess().Id);
                application = Application.Attach(proc.Id);

                Logger.Debug("Пустое приложение для тестирования запущено");
            }
            catch (Exception ex)
            {
                Logger.Error("Не удалось запустить пустое приложение. ", ex);
                return false;
            }
            return true;
        }
コード例 #6
0
ファイル: DialogProxies.cs プロジェクト: pvandervelde/Apollo
        public static Window DatasetMachineSelectionWindow(Application application, Log log)
        {
            const string prefix = "Dialogs - MachineSelectionWindow";
            if ((application == null) || application.HasExited)
            {
                throw new RegressionTestFailedException(prefix + ": Application does not exist or has already exited.");
            }

            // Note that the windows can't be found through an Automation ID for some reason, hence
            // using the title of the window.
            var mainWindow = MainWindow(application, log);
            if (mainWindow == null)
            {
                return null;
            }

            return Retry.Times(
                () =>
                {
                    log.Debug(prefix, "Trying to get the machine selection window.");

                    var window = mainWindow.ModalWindow("Select a machine for the dataset");
                    if (window == null)
                    {
                        log.Error(prefix, "Failed to get the machine selection window.");
                    }

                    return window;
                });
        }
コード例 #7
0
ファイル: TabProxies.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Closes the start page tab item via the close button on the tab item.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <exception cref="RegressionTestFailedException">
        ///     Thrown if the tab could not be closed via the close button for some reason.
        /// </exception>
        public static void CloseStartPageTab(Application application, Log log)
        {
            const string prefix = "Tabs - Close start page tab";
            var startPage = GetStartPageTabItem(application, log);
            if (startPage == null)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to find the start page tab.");
            }

            var closeTabSearchCriteria = SearchCriteria
                .ByAutomationId(WelcomeViewAutomationIds.CloseTabButton)
                .AndControlType(ControlType.Button);
            var closeTabButton = Retry.Times(() => (Button)startPage.Get(closeTabSearchCriteria));
            if (closeTabButton == null)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to find the close start page tab button.");
            }

            try
            {
                closeTabButton.Click();
            }
            catch (Exception e)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to close the project tab.", e);
            }
        }
 public void Initialize()
 {
     qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
     qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
     QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
     InitQB();
 }
コード例 #9
0
ファイル: Form1.cs プロジェクト: amw786/ASAR
        private void btnAudacity_Click(object sender, EventArgs e)
        {
            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe"))
            {
                MessageBox.Show("Audacity is not installed...");
                return;
            }
            try
            {
                System.Diagnostics.ProcessStartInfo audacityProcess = new System.Diagnostics.ProcessStartInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe");
                appAudacity = TestStack.White.Application.AttachOrLaunch(audacityProcess);

                audacityWindow           = appAudacity.GetWindow("Audacity", TestStack.White.Factory.InitializeOption.NoCache);
                audacityToolDock         = (TestStack.White.UIItems.Panel)audacityWindow.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("ToolDock"))[0];
                audacityTransportToolbar = (TestStack.White.UIItems.Panel)audacityToolDock.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Audacity Transport ToolBar"))[0];

                AudacityButton_Record      = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Record"))[0];
                AudacityButton_Pause       = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Pause"))[0];
                AudacityButton_Play        = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Play"))[0];
                AudacityButton_Stop        = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Stop"))[0];
                AudacityButton_SkipToStart = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to Start"))[0];
                AudacityButton_SkipToEnd   = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to End"))[0];

                this.TopMost = true;
                this.TopMost = false;
                this.Activate();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Window Unavailable\n" + ex.Message);
            }
        }
コード例 #10
0
        public void TestMethod1()
        {
            /*
             * Pattern file = new Pattern(@"C:\Users\Fabio\Desktop\jdownloaderImages\file.png");
             * Pattern max = new Pattern(@"C:\Users\Fabio\Desktop\jdownloaderImages\maximize.png");
             * Pattern aggiungi = new Pattern(@"C:\Users\Fabio\Desktop\jdownloaderImages\aggiungi.png");
             * Pattern testoAggiungi = new Pattern(@"C:\Users\Fabio\Desktop\jdownloaderImages\testoAggiungi.png");
             * Pattern continua = new Pattern(@"C:\Users\Fabio\Desktop\jdownloaderImages\continua.png");
             *
             *
             * TestStack.White.Application application = TestStack.White.Application.Launch(@"C:\Users\Fabio\AppData\Local\JDownloader v2.0\JDownloader2.exe");
             *
             * Thread.Sleep(5000);
             *
             * Sikuli4Net.sikuli_REST.Screen scr = new Sikuli4Net.sikuli_REST.Screen();
             * scr.Click(max);
             * scr.Click(file);
             * scr.Click(aggiungi);
             *
             * scr.Click(testoAggiungi);
             * SendKeys.SendWait("http://releases.ubuntu.com/19.04/ubuntu-19.04-desktop-amd64.iso");
             * Thread.Sleep(1000);
             * scr.Click(continua);
             *
             *
             * Thread.Sleep(4000);
             * application.Close();
             *
             */
            var file          = Patterns.FromFile(@"C:\Users\Fabio\Desktop\jdownloaderImages\file.png");
            var max           = Patterns.FromFile(@"C:\Users\Fabio\Desktop\jdownloaderImages\maximize.png", 0.8f);
            var aggiungi      = Patterns.FromFile(@"C:\Users\Fabio\Desktop\jdownloaderImages\aggiungi.png");
            var testoAggiungi = Patterns.FromFile(@"C:\Users\Fabio\Desktop\jdownloaderImages\testoAggiungi.png");
            var continua      = Patterns.FromFile(@"C:\Users\Fabio\Desktop\jdownloaderImages\continua.png");


            TestStack.White.Application application = TestStack.White.Application.Launch(@"C:\Users\Fabio\AppData\Local\JDownloader v2.0\JDownloader2.exe");

            Thread.Sleep(5000);

            using (var session = Sikuli.CreateSession())
            {
                try
                {
                    session.Click(max);
                }
                catch (SikuliFindFailedException e) { }
                session.Click(file);
                session.Click(aggiungi);

                session.Click(testoAggiungi);
                SendKeys.SendWait("http://releases.ubuntu.com/19.04/ubuntu-19.04-desktop-amd64.iso");
                Thread.Sleep(1000);
                session.Click(continua);
            }

            Thread.Sleep(4000);
            application.Close();
        }
コード例 #11
0
        public static void Main(string[] args)
        {
            Application launchapp     = Setup.launchPSC();
            Application application   = Setup.attachPSC();
            pscWindow   currentWindow = Setup.getWindow(application);

            Login.loginPSC(currentWindow);
        }
コード例 #12
0
 public void SetupTest()
 {
     Console.WriteLine("Setting up environment for the Test");
     Setup.launchPSC();
     application   = Setup.attachPSC();
     currentWindow = Setup.getWindow(application);
     //TestRunner runner = new TestRunner();
 }
コード例 #13
0
 public Window GetMainWindow(Application application)
 {
     WaitForApplicationIdle(application);
     var mainWindow = application.GetWindow(SearchCriteria.ByAutomationId("ShellWindow"), InitializeOption.WithCache);
     //var mainWindowAdapter = new ProxyGenerator().CreateInterfaceProxyWithoutTarget<IMainWindow>(new ForwardIfExistsInterceptor(mainWindow));
     //return mainWindowAdapter;
     return mainWindow;
 }
        public void CleanUp()
        {
            _mainWindow.Close();
            _application.Dispose();

            _application = null;
            _mainWindow = null;
        }
コード例 #15
0
        public void SetupApp()
        {
            string outputDir = new DirectoryInfo(Assembly.GetExecutingAssembly().Location).Parent.FullName;
            string app_path  = outputDir + @"\HospitalScheduling.exe.lnk";

            application = TestStack.White.Application.Launch(app_path);
            //Window mainWindow = application.GetWindow("LoginWindow");
        }
コード例 #16
0
 //SampleTest Class Constructor to launch PSC and get the current window of PSC
 // [TestFixtureSetUp]
 public void SetupTest()
 {
     application   = Setup.attachPSC();
     currentWindow = Setup.getWindow(application);
     standard      = new StandardOperations(currentWindow);
     search        = new SearchPage(currentWindow);
     tabs          = new Tabs(currentWindow);
 }
コード例 #17
0
 public void SetUp()
 {
     application     = Application.Launch(Path.Combine(TestContext.CurrentContext.TestDirectory, "YodaSpeak.exe"));
     window          = application.GetWindow("Yoda Speak");
     txtOriginalText = window.Get <TextBox>(SearchCriteria.ByAutomationId("txtOriginalText"));
     button          = window.Get <Button>(SearchCriteria.ByAutomationId("btnTranslate"));
     txtResult       = window.Get <Label>(SearchCriteria.ByAutomationId("txtResult"));
 }
コード例 #18
0
 public void TestInitialize()
 {
     qbApp = FrameworkLibraries.AppLibs.QBDT.WhiteAPI.QuickBooks.Initialize(exe);
     qbWindow = FrameworkLibraries.AppLibs.QBDT.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
     QuickBooks.ResetQBWindows(qbApp, qbWindow);
     invoiceNumber = rand.Next(12345, 99999);
     poNumber = rand.Next(12345, 99999);
 }
コード例 #19
0
 public void Initialize()
 {
     Logger test = new Logger("US_Commented_Reports_Test");
     qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
     qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
     QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
     InitQB();
 }
コード例 #20
0
ファイル: TestRunner.cs プロジェクト: skapil/pscwhite
 public TestRunner()
 {
     launchapp     = Setup.launchPSC();
     application   = Setup.attachPSC();
     currentWindow = Setup.getWindow(application);
     search        = new SearchPage(currentWindow);
     standard      = new StandardOperations(currentWindow);
     tabs          = new Tabs(currentWindow);
 }
コード例 #21
0
        /// <summary>
        /// Activates the dataset with the given ID.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <param name="id">The ID of the dataset that should be activated.</param>
        public static void ActivateDataset(Application application, Log log, int id)
        {
            const string prefix = "Project page - Activate dataset";
            if (IsDatasetActivated(application, log, id))
            {
                log.Info(
                    prefix,
                    "Dataset is already activated.");
                return;
            }

            var tab = TabProxies.GetProjectPageTabItem(application, log);
            if (tab == null)
            {
                throw new RegressionTestFailedException(prefix + " - Failed to get project tab.");
            }

            var datasets = GetDatasetControls(application, log);
            if (datasets.Count == 0)
            {
                throw new RegressionTestFailedException(prefix + " - Failed to get dataset controls.");
            }

            if (!datasets.ContainsKey(id))
            {
                throw new RegressionTestFailedException(prefix + " - Failed to find dataset with id: " + id.ToString(CultureInfo.InvariantCulture));
            }

            var buttonId = string.Format(
                CultureInfo.InvariantCulture,
                "Button_[{0}_[DatasetId: [{1}]]]",
                DatasetViewAutomationIds.DatasetActivateDeactivate,
                id);
            var buttonSearchCriteria = SearchCriteria
                .ByAutomationId(buttonId);
            var button = tab.Get<Button>(buttonSearchCriteria);
            if (button == null)
            {
                throw new RegressionTestFailedException(prefix + " - Failed to get activate dataset button.");
            }

            try
            {
                button.Click();
            }
            catch (Exception e)
            {
                throw new RegressionTestFailedException(prefix + " - Failed to activate the dataset.", e);
            }

            // handle dialog
            SelectMachineForDatasetActivation(application, log);

            // Wait for the dataset to be activated
            WaitForDatasetActivation(application, log, id);
        }
コード例 #22
0
        public void Setup()
        {
            application = Application.Launch(ConfigurationManager.AppSettings["NorthwindApp"]);
            window = new Windows();
            window.Initialise(application);

            employeeDetails = new EmployeeDetails();
            departmentDetails = new DepartmentDetails();
            projectDetails = new ProjectDetails();
        }
コード例 #23
0
        public void TestMethod1()
        {
            string app_path = @"D:\RESOURCES\DataSuite\1245\Console\DataSuite.Administration.Console.WinClient.exe";

            application = Application.Launch(app_path);
            Window mainWindow = application.GetWindow("DataSuite Console");

            //Added Lines of Code
            Console.WriteLine(mainWindow.Title);
            mainWindow.WaitWhileBusy();
            mainWindow.Close();
        }
コード例 #24
0
 public void Initialize()
 {
    
     qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
     qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
     QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
     //InitQB();
     if (!qbWindow.Title.Contains("COSMETICS"))
     {
         FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.OpenOrUpgradeCompanyFile(DefaultCompanyFilePath, qbApp, qbWindow, false, false);
     }
     qbWindow.Focus();
 }
コード例 #25
0
        public void SetupTest()
        {
            application   = Setup.attachPSC();
            currentWindow = Setup.getWindow(application);
            standard      = new StandardOperations(currentWindow);
            search        = new SearchPage(currentWindow);
            tabs          = new Tabs(currentWindow);
            bip           = new BasicInfoPage(currentWindow);
            aip           = new AdditionalInfoPage(currentWindow);

            //Searching for the patient
            search.SearchPatient(searchpatient);
            search.SelectFirstSearchRecord();
        }
コード例 #26
0
        public void OneTimeSetUp()
        {
            var title = "EnumRowWindow";
            this.application = Application.AttachOrLaunch(Info.CreateStartInfo(title));
            this.window = this.application.GetWindow(title);
            this.loseFocusButton = this.window.GetByText<Button>("lose focus");
            this.currentCultureTextBlock = this.window.Get<Label>("currentTextBlock");

            this.currentBox = this.window.FindRow("current").Value<ComboBox>();
            this.explicitTypeBox = this.window.FindRow("explicit_type").Value<ComboBox>();
            this.lostFocusBox = this.window.FindRow("lostfocus").Value<ComboBox>();
            this.readonlyBox = this.window.FindRow("readonly").Value<ComboBox>();
            this.editableBox = this.window.FindRow("editable").Value<ComboBox>();
        }
コード例 #27
0
        public void setup()
        {
            Logger test = new Logger("General");  
            qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
            qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
            QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
            InitQB();
            if (!qbWindow.Title.Contains("COSMETICS"))
            {
                FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.OpenOrUpgradeCompanyFile(DefaultCompanyFilePath, qbApp, qbWindow, false, false);
            }
            qbWindow.Focus();
            //Set Bringback one time messages to true and Set the Desktop view to support multiple windows 
            //Reports.ResetQBPrefForCommentedReports(qbApp, qbWindow);
 
        }
コード例 #28
0
 void Commands.CloseProgram(string name)
 {
     try
     {
         Process[] process = Process.GetProcessesByName(name);
         foreach (Process proc in process)
         {
             TestStack.White.Application application = TestStack.White.Application.Attach(proc);
             application.Close();
         }
         SendMessage("success");
     } catch (Win32Exception e)
     {
         SendMessage("error");
     }
 }
コード例 #29
0
        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();
        }
コード例 #30
0
        public AuctionSniperDriver(int timeoutMillis, string[] args)
        {
            this.timeoutMillis = timeoutMillis;

            int processId = startSniper(args);

            application = Application.Attach(processId);

            Assert.IsNotNull(application, "application is null");

            window = application.GetWindow(Program.APPLICATION_TITLE, InitializeOption.NoCache);

            Assert.IsNotNull(window, "window is null");

            itemIdField    = window.Get <TextBox>(Program.NEW_ITEM_ID_NAME);
            stopPriceField = window.Get <TextBox>(Program.NEW_ITEM_STOP_PRICE_NAME);
            bidButton      = window.Get <Button>(Program.JOIN_BUTTON_NAME);
        }
コード例 #31
0
ファイル: MenuProxies.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Closes a project via the 'File - Close' menu.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <exception cref="RegressionTestFailedException">
        ///     Thrown if the 'File - Close' menu could not be invoked for some reason.
        /// </exception>
        public static void CloseProjectViaFileCloseMenuItem(Application application, Log log)
        {
            const string prefix = "Menus - Close project via File menu";
            var closeMenu = GetFileCloseMenuItem(application, log);
            if (closeMenu == null)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to get the 'File - Close' menu item.");
            }

            try
            {
                closeMenu.Click();
            }
            catch (Exception e)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to click the 'File - Close' menu item.", e);
            }
        }
コード例 #32
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        public TestResult InitializeShowWelcomePageCheckbox(Application application, Log log)
        {
            const string prefix = "Initialize show welcome page";
            var result = new TestResult();
            try
            {
                WelcomePageControlProxies.UncheckShowWelcomePageOnApplicationStart(application, log);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
コード例 #33
0
ファイル: TestContext.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Initializes a new instance of the <see cref="TestContext"/> class.
        /// </summary>
        /// <param name="path">The full path to the application executable.</param>
        /// <param name="log">The log for the test.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="path"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     Thrown if <paramref name="path"/> is an empty string.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="log"/> is <see langword="null" />.
        /// </exception>
        public TestContext(string path, Log log)
        {
            {
                Lokad.Enforce.Argument(() => path);
                Lokad.Enforce.Argument(() => path, Lokad.Rules.StringIs.NotEmpty);
                Lokad.Enforce.Argument(() => log);
            }

            m_Log = log;
            m_Application = ApplicationProxies.StartApplication(path, log);
            if ((m_Application == null) || (m_Application.Process == null) || Application.Process.HasExited)
            {
                throw new RegressionTestFailedException();
            }

            var text = string.Format(
                CultureInfo.InvariantCulture,
                "Started [{0}] - PID: [{1}]",
                m_Application.Name,
                m_Application.Process.Id);
            log.Info("TestContext - Create", text);
        }
コード例 #34
0
ファイル: WhiteAppHijacker.cs プロジェクト: peterson1/ErrH
        public override bool AttachOrLaunch(string applicationExePath)
        {
            Info_n("Starting App Watcher...", "for: " + applicationExePath);

            try
            {
                var proc = new ProcessStartInfo(applicationExePath);
                _app = Application.AttachOrLaunch(proc);
            }
            catch (Exception ex) {
                return Error_n("Failed to start app watcher.", ex.Details(true, false)); }

            this._find = ForwardLogs(new WhiteElementFinder(_app));
            this.Find = this._find;
            this.Driver = ForwardLogs(new WhiteUiDriver(_find));


            AddHandlerForWindowOpened();


            return true;
        }
コード例 #35
0
ファイル: TestBase.cs プロジェクト: nanohex/ServiceInsight
 public void InitializeApplication()
 {
     try
     {
         Logger = new WhiteDefaultLoggerFactory(TestLoggerLevel).Create(typeof (TestBase));
         Wait = new Waiter();
         NameGenerator = new NameGenerator();
         ServiceControlStub = ServiceControl.Start();
         Configuration = new ProfilerConfiguration();
         Application = Configuration.LaunchApplication();
         MainWindow = Configuration.GetMainWindow(Application);
         Container = CreateContainer();
         OnApplicationInitialized();
         OnSetupUI();
     }
     catch (Exception ex)
     {
         Logger.Error("Failed to launch application and get main window", ex);
         TryCloseApplication();
         throw;
     }
 }
コード例 #36
0
 public void InitApplicationForTests()
 {
     app          = TestStack.White.Application.Launch("C:\\Users\\Dima\\Documents\\Visual Studio 2017\\Projects\\UKPO2\\Interface\\bin\\Debug\\interface.exe");
     window       = app.GetWindow("MainWindow");
     submitButton =
         window.Get <Button>(SearchCriteria.ByAutomationId("SubmitInputButton"));
     calculateButton =
         window.Get <Button>(SearchCriteria.ByAutomationId("FindPathsButton"));
     restartButton =
         window.Get <Button>(SearchCriteria.ByAutomationId("RestartButton"));
     moleculeName =
         window.Get <TextBox>(SearchCriteria.ByAutomationId("MoleculeInputTextBox"));
     fragmentsNum =
         window.Get <TextBox>(SearchCriteria.ByAutomationId("FragNumTextBox"));
     moleculeNameLabel =
         window.Get <Label>(SearchCriteria.ByAutomationId("MoleculeNameLabel"));
     fragmentsList =
         window.Get <ListBox>(SearchCriteria.ByAutomationId("FragmentsListBox"));
     pathsList =
         window.Get <ListBox>(SearchCriteria.ByAutomationId("OutputPathsListBox"));
     testCheckBox =
         window.Get <CheckBox>(SearchCriteria.ByAutomationId("TestDataCheckBox"));
 }
コード例 #37
0
 public void InitApplicationForTests()
 {
     app          = TestStack.White.Application.Launch(@"..\..\..\..\Interface\bin\x64\Debug\Interface.exe");
     window       = app.GetWindow("MainWindow");
     submitButton =
         window.Get <Button>(SearchCriteria.ByAutomationId("SubmitInputButton"));
     calculateButton =
         window.Get <Button>(SearchCriteria.ByAutomationId("FindPathsButton"));
     restartButton =
         window.Get <Button>(SearchCriteria.ByAutomationId("RestartButton"));
     moleculeName =
         window.Get <TextBox>(SearchCriteria.ByAutomationId("MoleculeInputTextBox"));
     fragmentsNum =
         window.Get <TextBox>(SearchCriteria.ByAutomationId("FragNumTextBox"));
     moleculeNameLabel =
         window.Get <Label>(SearchCriteria.ByAutomationId("MoleculeNameLabel"));
     fragmentsList =
         window.Get <ListBox>(SearchCriteria.ByAutomationId("FragmentsListBox"));
     pathsList =
         window.Get <ListBox>(SearchCriteria.ByAutomationId("OutputPathsListBox"));
     testCheckBox =
         window.Get <CheckBox>(SearchCriteria.ByAutomationId("TestDataCheckBox"));
 }
コード例 #38
0
        private void InitiateSqlSnap()
        {
            var app    = TestStack.White.Application.Launch(pathSqlSnaps);
            var window = app.GetWindows()[0];

            var scFilterDBs    = SearchCriteria.ByAutomationId("txt_FilterDB");
            var scFilterSPIDs  = SearchCriteria.ByAutomationId("txt_FilterSPID");
            var scSnapInterval = SearchCriteria.ByAutomationId("NumericUpDown1");
            var scSqlServer    = SearchCriteria.ByAutomationId("TextBox1");
            var scSnapToggle   = SearchCriteria.ByAutomationId("chk_AutoSnap");

            if (!String.IsNullOrWhiteSpace(SqlSnap_CaptureInterval))
            {
                window.Get(scSnapInterval).Focus();
                Keyboard.Instance.HoldKey(KeyboardInput.SpecialKeys.CONTROL);
                Keyboard.Instance.Enter("a");
                Keyboard.Instance.LeaveKey(KeyboardInput.SpecialKeys.CONTROL);
                Keyboard.Instance.Enter(SqlSnap_CaptureInterval);
            }
            if (!String.IsNullOrWhiteSpace(Database))
            {
                window.Get <TextBox>(scFilterDBs).SetValue(Database);
            }
            if (!String.IsNullOrWhiteSpace(SqlSnap_SPIDs))
            {
                window.Get <TextBox>(scFilterSPIDs).SetValue(SqlSnap_SPIDs);
            }


            if (!String.IsNullOrWhiteSpace(SqlServer))
            {
                window.Get <TextBox>(scSqlServer).SetValue(SqlServer);
            }

            window.Get <CheckBox>(scSnapToggle).Select();
            _sqlSnaps = app;
        }
コード例 #39
0
        public static void ExitApplication(Application application, Log log)
        {
            const string prefix = "Application - Exit";
            if (application != null)
            {
                log.Info(prefix, "Closing application.");
                try
                {
                    application.Close();
                    if (application.Process.HasExited)
                    {
                        return;
                    }

                    application.Process.WaitForExit(Constants.ShutdownWaitTimeInMilliSeconds());
                    if (!application.Process.HasExited)
                    {
                        application.Kill();
                    }
                }
                catch (InvalidOperationException)
                {
                    // Do nothing because the cause for this exception is when there is no process
                    // associated with the application.Process object.
                }
                catch (Exception e)
                {
                    log.Error(
                        prefix,
                        string.Format(
                            CultureInfo.InvariantCulture,
                            "Error trying to terminate application. Error was: {0}",
                            e));
                }
            }
        }
コード例 #40
0
ファイル: UnitTest1.cs プロジェクト: MuratovaLera/UKPOWin
 public void SetUp()
 {
     leraApp    = Application.Launch("..\\..\\..\\MyPoker\\bin\\Debug\\MyPoker.exe");
     mainWindow = leraApp.GetWindow("NLP");
 }
コード例 #41
0
        public void ConvertAnimsToAsc(SortedSet <string> toConvert = null)
        {
            KeyboardInput.SpecialKeys specialKey;
            string[] files = Helper.GetFiles(string.Concat(this.GothicDir, "_WORK\\DATA\\ANIMS\\"), "_COMPILED\\*.*|MDS_MOBSI\\*.*", SearchOption.AllDirectories);
            TestStack.White.Application application = TestStack.White.Application.Launch(this.GothicSourcerExe);
            Window window = application.GetWindows().First <Window>();

            Helper.ResetWindow(window.Title);
            string[] strArrays = files;
            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                string str = strArrays[i];
                string ext = Path.GetExtension(str).ToUpper();

                if (ext == ".MDL")
                {
                    specialKey = KeyboardInput.SpecialKeys.SHIFT;
                }
                else if ((ext == ".MDS") || (ext == ".MSB"))
                {
                    specialKey = KeyboardInput.SpecialKeys.CONTROL;
                }
                else if (ext == ".MMB")
                {
                    specialKey = KeyboardInput.SpecialKeys.ALT;
                }
                else
                {
                    continue;
                }

                if (!File.Exists(string.Concat(new string[] { this.GothicDir, "_WORK\\DATA\\ANIMS\\asc_", Path.GetFileNameWithoutExtension(str).ToLower(), "\\", Path.GetFileNameWithoutExtension(str).ToUpper(), ".ASC" })))
                {
                    if (!File.Exists(string.Concat(new string[] { this.GothicDir, "_WORK\\DATA\\ANIMS\\asc_", Path.GetFileNameWithoutExtension(str).ToLower(), "\\", Path.GetFileNameWithoutExtension(str).ToUpper(), ".MDS" })) && !File.Exists(string.Concat(this.GothicDir, "_WORK\\DATA\\ANIMS\\asc_static\\", Path.GetFileNameWithoutExtension(str).ToUpper(), ".ASC")))
                    {
                        if (toConvert == null || toConvert.Contains(Path.GetFileNameWithoutExtension(str).ToUpper()))
                        {
                            while (application.GetWindows().Count == 1)
                            {
                                window.Keyboard.HoldKey(specialKey);
                                window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.F8);
                                window.Keyboard.LeaveKey(specialKey);
                            }
                            window.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("1047")).Text = str;
                            window.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("1048")).Text = string.Concat(this.GothicDir, "_WORK\\DATA\\");
                            window.Get <TestStack.White.UIItems.ListBoxItems.ComboBox>(SearchCriteria.ByAutomationId("1051")).Select(this.GothicVersion);
                            try
                            {
                                window.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("1")).Click();
                            }
                            catch
                            {
                            }
                            string text = "";
                            do
                            {
                                text = window.Get <TestStack.White.UIItems.ListView>(SearchCriteria.ByAutomationId("1001")).Rows.Last <ListViewRow>().Cells.First <ListViewCell>().Text;
                                Thread.Sleep(100);
                            }while (!text.Contains("error(s)") || !text.Contains("warning(s)"));
                        }
                    }
                }
            }
            application.Kill();
        }
コード例 #42
0
        public void TestMethod1()
        {
            TestStack.White.Application app = base.Application;
            Window window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache);

            Delete_LevelData();
            window.WaitWhileBusy();
            //click the cont button
            Button contBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button2"));

            contBtn.Click();

            // get cont window
            Window cont = app.GetWindow(SearchCriteria.ByAutomationId("ContinueGame"), InitializeOption.WithCache);

            cont.WaitWhileBusy();

            IUIItem[] children1 = cont.GetMultiple(SearchCriteria.All);
            //get lvl 1 button
            Button lvl1Btn = (Button)children1[1];

            lvl1Btn.Click();
            // get game window
            Window game = app.GetWindow(SearchCriteria.ByAutomationId("Form1"), InitializeOption.NoCache);

            game.Focus();

            UIItemCollection items = game.Items;

            items[24].Focus();

            SendKeys.Send("{SPACE}");



            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);


            Window win = app.GetWindow(SearchCriteria.ByAutomationId("LevelComplete"), InitializeOption.WithCache);

            win.WaitWhileBusy();
            children1 = win.GetMultiple(SearchCriteria.All); //35

            Button saveBtn = (Button)children1[4];

            saveBtn.Click();
            win.WaitWhileBusy();

            Button quitBtn = (Button)children1[5];

            quitBtn.Click();

            app.Close();
            app.Dispose();
        }
コード例 #43
0
ファイル: Form1.cs プロジェクト: JacobD10/ASAR
        private void btnAudacity_Click(object sender, EventArgs e)
        {
            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe"))
            {
                MessageBox.Show("Audacity is not installed...");
                return;
            }
            try
            {
                System.Diagnostics.ProcessStartInfo audacityProcess = new System.Diagnostics.ProcessStartInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe");
                appAudacity = TestStack.White.Application.AttachOrLaunch(audacityProcess);

                audacityWindow = appAudacity.GetWindow("Audacity", TestStack.White.Factory.InitializeOption.NoCache);
                audacityToolDock = (TestStack.White.UIItems.Panel)audacityWindow.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("ToolDock"))[0];
                audacityTransportToolbar = (TestStack.White.UIItems.Panel)audacityToolDock.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Audacity Transport ToolBar"))[0];

                AudacityButton_Record = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Record"))[0];
                AudacityButton_Pause = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Pause"))[0];
                AudacityButton_Play = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Play"))[0];
                AudacityButton_Stop = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Stop"))[0];
                AudacityButton_SkipToStart = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to Start"))[0];
                AudacityButton_SkipToEnd = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to End"))[0];

                this.TopMost = true;
                this.TopMost = false;
                this.Activate();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Window Unavailable\n"+ex.Message);
            }
        }
コード例 #44
0
 public void StartApplication()
 {
     var startInfo = new ProcessStartInfo("MontyHallKata.exe");
     application = Application.Launch(startInfo);
     mainWindow = application.GetWindow("MainWindow", InitializeOption.NoCache);
 }
コード例 #45
0
ファイル: BeamProcess.cs プロジェクト: ramteju/Sample-Project
        public static void RunOCRonBluebeamtool(string folderpath)
        {
            try
            {
                ProcessHandlers.killapp("Revu");
                var psi = new ProcessStartInfo(ExeSourceFile);
                psi.UseShellExecute = true;
                _application        = TestStack.White.Application.AttachOrLaunch(psi);
                Process p = Process.GetProcessesByName("Revu").FirstOrDefault();
                while (p.MainWindowHandle == IntPtr.Zero)
                {
                    p.Refresh();
                }
                p.WaitForInputIdle();
                if (p != null)
                {
                    IntPtr h = p.MainWindowHandle;
                    ProcessHandlers.SetForegroundWindow(h);
                    p.WaitForInputIdle();
                    IntPtr hPRAZChem = ProcessHandlers.FindWindow(null, "Bluebeam Revu x64");
                    if (!hPRAZChem.Equals(IntPtr.Zero))
                    {
                        ProcessHandlers.SetForegroundWindow(hPRAZChem);
                    }
                    p.WaitForInputIdle();

                    Thread.Sleep(3000);


                    sendkeyevent(1, "%");
                    //  sendkeyevent(1, "{RIGHT}");
                    sendkeyevent(1, "{DOWN}");
                    sendkeyevent(7, "{RIGHT}");
                    sendkeyevent(1, "{ENTER}");
                    sendkeyevent(1, "{DOWN}");
                    sendkeyevent(1, "{ENTER}");

                    IntPtr hPRAZChem1 = ProcessHandlers.FindWindow(null, "Add Files for Batch Processing");
                    p.WaitForInputIdle();
                    if (!hPRAZChem1.Equals(IntPtr.Zero))
                    {
                        ProcessHandlers.SetForegroundWindow(hPRAZChem1);
                    }
                    p.WaitForInputIdle();

                    SendKeys.SendWait(folderpath);
                    Thread.Sleep(10000);
                    if (folderpath.Contains(".pdf"))
                    {
                        sendkeyevent(4, "{ENTER}");
                    }
                    else
                    {
                        sendkeyevent(1, "{ENTER}");
                        Thread.Sleep(3000);
                        sendkeyevent(8, "{TAB}");
                        sendkeyevent(1, "^(a)");
                        // SendKeys.SendWait("{A}");
                        sendkeyevent(4, "{ENTER}");
                    }
                    checkprogress();
                    checkprogress();
                    p.WaitForInputIdle();
                    ProcessHandlers.killapp("Revu");
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #46
0
ファイル: WhiteE2ETests.cs プロジェクト: jesusico83/Telerik
        /// <summary>
        ///     Tries to find the wizard after it is launched.
        /// </summary>
        /// <returns>the wizard element</returns>
        private Window GetWizard(string wizardName)
        {
            Trace.WriteLine(DateTime.Now.ToLongTimeString() + ":In GetWizard");

            _visualStudio = Application.Attach(Process.GetCurrentProcess().Id);
            _visualStudioMainWindow = _visualStudio.GetWindow(
                SearchCriteria.ByAutomationId("VisualStudioMainWindow"),
                InitializeOption.NoCache);

            var wizard = _visualStudio.Find(
                x => x.Equals(_resourceHelper.GetEntityDesignResourceString(wizardName)),
                InitializeOption.NoCache);
            return wizard;
        }
コード例 #47
0
ファイル: Class1.cs プロジェクト: sumit6777/BPOWBDemo
 public Class1(Application app)
 {
     //_window = app.GetWindow("Operators WorkBench");
     _window = app.GetWindow("Operators WorkBench");
 }
コード例 #48
0
 public override Window GetMainWindow(Application application)
 {
     var ieWindow = (InternetExplorerWindow)application.GetWindow("TestSilverlightApplication - Windows Internet Explorer");
     return ieWindow.SilverlightDocument;
 }
コード例 #49
0
 public SettingsWindow(Application application, Window whiteWindow, UIItem settingsControl)
     : base(application, whiteWindow)
 {
     this.settingsControl = settingsControl;
 }
コード例 #50
0
 public void OneTimeSetUp()
 {
     var title = "NestedWindow";
     this.application = Application.AttachOrLaunch(Info.CreateStartInfo(title));
     this.window = this.application.GetWindow(title);
 }
コード例 #51
0
 public override Window GetMainWindow(Application application)
 {
     return application.GetWindow(Criteria(), InitializeOption.NoCache);
 }
 private void Given()
 {
     _application = Application.Launch(AppFileName);
     _mainWindow = _application.GetWindow("Music Manager", InitializeOption.NoCache);
     Menu selectFileMenuItem = _mainWindow.MenuBar.MenuItem("File", "Select Files (.mp3)");
     selectFileMenuItem.Click();
 }