コード例 #1
0
        public void LaunchSystemApp()
        {
            DesiredCapabilities appCapabilities = new DesiredCapabilities();

            appCapabilities.SetCapability("app", CommonTestSettings.ExplorerAppId);
            WindowsDriver <WindowsElement> session = new WindowsDriver <WindowsElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appCapabilities);

            Assert.IsNotNull(session);
            Assert.IsNotNull(session.SessionId);

            var originalTitle = session.Title;
            var originalWindowHandlesCount   = session.WindowHandles.Count;
            var originalLaunchedWindowHandle = session.CurrentWindowHandle;

            session.LaunchApp();

            Assert.AreEqual(originalTitle, session.Title);
            Assert.AreEqual(originalWindowHandlesCount + 1, session.WindowHandles.Count);
            Assert.AreNotEqual(originalLaunchedWindowHandle, session.CurrentWindowHandle);

            session.Close();
            session.SwitchTo().Window(originalLaunchedWindowHandle);
            session.Close();
            session.Quit();
        }
コード例 #2
0
ファイル: BaseTest.cs プロジェクト: ashotav/Outlook
        public void Setup()
        {
            string testname = TestContext.CurrentContext.Test.MethodName;

            //helper.cleanupInbox();
            extentTest = GlobalTestSetup.extent.CreateTest(testname);
            if (!helper.isAppRuning(driver))
            {
                driver.LaunchApp();
                helper.waitUntilOutlookOpens(driver);
            }
            extentTest.Info("Outlook opens");
        }
コード例 #3
0
        public static void Setup(TestContext testContext)
        {
            DesiredCapabilities appCapabilities = new DesiredCapabilities();

            appCapabilities.SetCapability("app", @"C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE");
            Session = new WindowsDriver <WindowsElement>(new Uri("http://127.0.0.1:4723"), appCapabilities);
            Assert.IsNotNull(Session);
            // Wait for 5 seconds or however long it is needed for the right window to appear/for the splash screen to be dismissed
            Thread.Sleep(TimeSpan.FromSeconds(5));
            // When the application uses pre-launched existing instance, re-launching the application simply update
            // the current application window to whatever current main window belonging to the same application
            // process id
            Session.LaunchApp();
        }
コード例 #4
0
ファイル: Scraper.cs プロジェクト: YurkoUA/ViberScraper
        public void Run()
        {
            var appCapabilities = new DesiredCapabilities();

            appCapabilities.SetCapability("app", _options.ViberAppId);
            _session = new WindowsDriver <WindowsElement>(new Uri(_options.WinAppDriverUrl), appCapabilities);
            _session.LaunchApp();

            Thread.Sleep(5000);

            _session.FindElementByAccessibilityId("SearchIcon").Click();
            _searchTextBox = _session.FindElementByAccessibilityId("SearchTextBox");

            FindContactControlId();
            ProceedNumbers();
        }
コード例 #5
0
        public static void LaunchPowerToys()
        {
            try
            {
                AppiumOptions opts = new AppiumOptions();
                opts.PlatformName = "Windows";
                opts.AddAdditionalCapability("app", "Microsoft.PowerToys_8wekyb3d8bbwe!PowerToys");

                WindowsDriver <WindowsElement> driver = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), opts);
                Assert.IsNotNull(driver);
                driver.LaunchApp();
            }
            catch (OpenQA.Selenium.WebDriverException)
            {
                //exception could be thrown even if app launched successfully
            }
        }
コード例 #6
0
        public void Launch_ClassicApp()
        {
            session = Utility.CreateNewSession(CommonTestSettings.NotepadAppId);
            var originalSessionId            = session.SessionId;
            var originalTitle                = session.Title;
            var originalLaunchedWindowHandle = session.CurrentWindowHandle;

            // Close notepad application session created above without quitting
            session.Close();
            Assert.IsNotNull(session.SessionId);

            // Re-launch notepad application in the same session using the same capabilities configuration
            session.LaunchApp();
            Assert.AreEqual(originalSessionId, session.SessionId);
            Assert.AreEqual(originalTitle, session.Title);
            Assert.AreNotEqual(originalLaunchedWindowHandle, session.CurrentWindowHandle);
        }
コード例 #7
0
ファイル: PowerToysSession.cs プロジェクト: zhiles/PowerToys
        public static void LaunchPowerToys()
        {
            AppiumOptions opts = new AppiumOptions();

            opts.AddAdditionalCapability("app", AppPath);

            try
            {
                WindowsDriver <WindowsElement> driver = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), opts);
                Assert.IsNotNull(driver);
                driver.LaunchApp();
            }
            catch (WebDriverException)
            {
                //exception is expected since WinApDriver tries to find main app window
            }

            isPowerToysLaunched = true;
        }
コード例 #8
0
        public void Launch_SystemApp()
        {
            session = Utility.CreateNewSession(CommonTestSettings.ExplorerAppId);
            var originalSessionId            = session.SessionId;
            var originalTitle                = session.Title;
            var originalWindowHandlesCount   = session.WindowHandles.Count;
            var originalLaunchedWindowHandle = session.CurrentWindowHandle;

            // Re-launch Windows Explorer in the same session using the same capabilities configuration
            // This will create a new explorer window and point the current active session to it
            session.LaunchApp();
            Assert.AreEqual(originalSessionId, session.SessionId);
            Assert.AreEqual(originalTitle, session.Title);
            Assert.AreEqual(originalWindowHandlesCount + 1, session.WindowHandles.Count);
            Assert.AreNotEqual(originalLaunchedWindowHandle, session.CurrentWindowHandle);

            session.Close();
            session.SwitchTo().Window(originalLaunchedWindowHandle);
            session.Close();
        }
コード例 #9
0
        public static void LaunchPowerToys()
        {
            try
            {
                AppiumOptions opts = new AppiumOptions();
                opts.PlatformName = "Windows";
                opts.AddAdditionalCapability("app", AppPath);

                WindowsDriver <WindowsElement> driver = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), opts);
                Assert.IsNotNull(driver);
                driver.LaunchApp();
            }
            catch (OpenQA.Selenium.WebDriverException ex)
            {
                Console.WriteLine("Exception on PowerToys launch:" + ex.Message);
                //exception could be thrown even if app launched successfully
            }

            isPowerToysLaunched = true;
        }
コード例 #10
0
        public void Launch_ModernApp()
        {
            session = Utility.CreateNewSession(CommonTestSettings.CalculatorAppId);
            var originalSessionId            = session.SessionId;
            var originalTitle                = session.Title;
            var originalWindowHandlesCount   = session.WindowHandles.Count;
            var originalLaunchedWindowHandle = session.CurrentWindowHandle;

            // Re-launch calculator application in the same session using the same capabilities configuration
            // This will create a new calculator window and point the current active session to it
            session.LaunchApp();
            Assert.AreEqual(originalSessionId, session.SessionId);
            Assert.IsTrue(originalTitle.Contains(session.Title));
            Assert.AreEqual(originalWindowHandlesCount + 1, session.WindowHandles.Count);
            Assert.AreNotEqual(originalLaunchedWindowHandle, session.CurrentWindowHandle);

            session.Close();
            session.SwitchTo().Window(originalLaunchedWindowHandle);
            session.Close();
        }