Пример #1
0
        public void Test03_VerifyNotepadAcceptsAlphaNumeric()
        {
            /* Steps to the test :
             * 1.TestInitialize() and TestCleanup() will automatically
             * start the notepad application and close it ater its done
             * 2. Write on the notepad editor
             * 3. Verify the data on the editor
             */

            /*
             * This test can be further extended for other type of characters and different variation
             * of the text input.
             */

            // Verify alphabets
            var editWindow = notepadSession.FindElementByClassName("Edit");

            editWindow.SendKeys("qwertyuiopasdfghjklzxcvbnm");
            Assert.AreEqual(editWindow.Text, "qwertyuiopasdfghjklzxcvbnm");
            editWindow.Clear();

            // Verify numeric characters
            editWindow.SendKeys("1234567890");
            Assert.AreEqual(editWindow.Text, "1234567890");
            editWindow.Clear();

            // Verify alpha-numeric characters
            editWindow.SendKeys("qwertyuiopasdfghjklzxcvbnm1234567890");
            Assert.AreEqual(editWindow.Text, "qwertyuiopasdfghjklzxcvbnm1234567890");
        }
Пример #2
0
        public static void ClassInitialize(TestContext context)
        {
            // Create session to launch a Calculator window
            Setup(context);

            // Identify calculator mode by locating the header
            try
            {
                header = session.FindElementByAccessibilityId("Header");
            }
            catch
            {
                header = session.FindElementByAccessibilityId("ContentPresenter");
            }

            // Ensure that calculator is in standard mode
            if (!header.Text.Equals("Standard", StringComparison.OrdinalIgnoreCase))
            {
                session.FindElementByAccessibilityId("TogglePaneButton").Click();
                Thread.Sleep(TimeSpan.FromSeconds(1));
                var splitViewPane = session.FindElementByClassName("SplitViewPane");
                splitViewPane.FindElementByName("Standard Calculator").Click();
                Thread.Sleep(TimeSpan.FromSeconds(1));
                Assert.IsTrue(header.Text.Equals("Standard", StringComparison.OrdinalIgnoreCase));
            }

            // Locate the calculatorResult element
            calculatorResult = session.FindElementByAccessibilityId("CalculatorResults");
            Assert.IsNotNull(calculatorResult);
        }
Пример #3
0
        public LauncherPage(WindowsDriver <WindowsElement> session)
        {
            this.session = session;
            //[FindsBy(How = How.ClassName, Using = "WindowsForms10.COMBOBOX.app.0.13965fa_r30_ad1")]

            projectComboBox = session.FindElementByClassName("WindowsForms10.COMBOBOX.app.0.13965fa_r30_ad1");
        }
Пример #4
0
        public static void Setup(TestContext context)
        {
            // Launch Calculator if it is not yet launched
            if (session == null || touchScreen == null)
            {
                session = Utility.CreateNewSession(CommonTestSettings.CalculatorAppId);
                Assert.IsNotNull(session);
                Assert.IsNotNull(session.SessionId);

                try
                {
                    header = session.FindElementByAccessibilityId("Header");
                }
                catch
                {
                    header = session.FindElementByAccessibilityId("ContentPresenter");
                }
                Assert.IsNotNull(header);

                // Initialize touch screen object
                touchScreen = new RemoteTouchScreen(session);
                Assert.IsNotNull(touchScreen);
            }

            // Ensure that calculator is in standard mode
            if (!header.Text.Equals("Standard", StringComparison.OrdinalIgnoreCase))
            {
                session.FindElementByAccessibilityId("NavButton").Click();
                Thread.Sleep(TimeSpan.FromSeconds(1));
                var splitViewPane = session.FindElementByClassName("SplitViewPane");
                splitViewPane.FindElementByName("Standard Calculator").Click();
                Thread.Sleep(TimeSpan.FromSeconds(1));
                Assert.IsTrue(header.Text.Equals("Standard", StringComparison.OrdinalIgnoreCase));
            }
        }
Пример #5
0
        public static void Setup(TestContext context)
        {
            // Launch a new instance of Notepad application
            if (session == null)
            {
                // Create a new session to launch Notepad application
                AppiumOptions opt = new AppiumOptions();
                opt.AddAdditionalCapability("app", NotepadAppId);
                opt.AddAdditionalCapability("platformName", "Windows");
                opt.AddAdditionalCapability("deviceName", "WindowsPC");
                session = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), opt);


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

                // Verify that Notepad is started with untitled new file
                // IMPORTANT NOTE FOR ERRORS: If your Windows language is not English, you need to adjust the string to your localised text. (Also other texts in this demo.)
                Assert.AreEqual("Untitled - Notepad", session.Title);

                // Set implicit timeout to 1.5 seconds to make element search to retry every 500 ms for at most three times
                session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1.5);

                // Keep track of the edit box to be used throughout the session
                editBox = session.FindElementByClassName("Edit");
                Assert.IsNotNull(editBox);
            }
        }
Пример #6
0
        public void NavigateForwardSystemApp()
        {
            DesiredCapabilities appCapabilities = new DesiredCapabilities();

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

            var originalTitle = session.Title;
            //Assert.AreNotEqual(String.Empty, originalTitle);

            // Navigate Windows Explorer to change folder
            var targetLocation  = @"%TEMP%\";
            var addressBandRoot = session.FindElementByClassName("Address Band Root");
            var addressToolbar  = addressBandRoot.FindElementByAccessibilityId("1001"); // Address Band Toolbar

            session.Mouse.Click(addressToolbar.Coordinates);
            addressBandRoot.FindElementByAccessibilityId("41477").SendKeys(targetLocation + OpenQA.Selenium.Keys.Enter);
            System.Threading.Thread.Sleep(1000); // Sleep for 1 second
            var newTitle = session.Title;

            Assert.AreNotEqual(originalTitle, newTitle);

            // Navigate back to the original folder
            session.Navigate().Back();
            Assert.AreEqual(originalTitle, session.Title);

            // Navigate forward to the target folder
            session.Navigate().Forward();
            Assert.AreEqual(newTitle, session.Title);

            session.Quit();
        }
        public void SetUp()
        {
            // Start up winApp driver application silently
            Process = new Process();
            Process.StartInfo.FileName    = WindowsApplicationDriverPath;
            Process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            Process.Start();

            // Launch calculator application
            var appCapabilities = new DesiredCapabilities();

            appCapabilities.SetCapability("app", CalculatorAppId);
            appCapabilities.SetCapability("deviceName", "WindowsPC");
            CalculatorSession = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);

            // if original way is not working
            // Launch desktop session
            appCapabilities = new DesiredCapabilities();
            appCapabilities.SetCapability("app", "Root");
            DesktopSession = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);

            // Use desktop session to find calculator
            var calculatorWindow = DesktopSession.FindElementByClassName("ApplicationFrameWindow");
            var calculatorTopLevelWindowHandle = calculatorWindow.GetAttribute("NativeWindowHandle");

            calculatorTopLevelWindowHandle = (int.Parse(calculatorTopLevelWindowHandle)).ToString("x"); // Convert to Hex

            // Create session by attaching to calculator top level window
            appCapabilities = new DesiredCapabilities();
            appCapabilities.SetCapability("appTopLevelWindow", calculatorTopLevelWindowHandle);
            WindowsDriver = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);

            //WindowsDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(0.1));
            BaseView = new BaseView(WindowsDriver);
        }
Пример #8
0
        public static void Setup(TestContext context)
        {
            // Launch a new instance of Notepad application
            if (ourSession == null)
            {
                // Create a new session to launch Notepad application
                var options = new AppiumOptions();
                options.AddAdditionalCapability("app", NotepadAppId);
                options.AddAdditionalCapability("deviceName", "WindowsPC");
                ourSession = new WindowsDriver <WindowsElement>(new Uri(WinAppDriverUrl), options);

                Assert.IsNotNull(ourSession);
                Assert.IsNotNull(ourSession.SessionId);

                // Verify that Notepad is started with untitled new file
                Assert.AreEqual("Untitled - Notepad", ourSession.Title);

                // Set implicit timeout to 1.5 seconds to make element search to retry every 500 ms for at most three times.
                ourSession.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1.5);

                // Keep track of the edit box to be used throughout the session
                ourEditbox = ourSession.FindElementByClassName("Edit");
                Assert.IsNotNull(ourEditbox);
            }
        }
Пример #9
0
        public void InputTextInNotepadWindow()
        {
            // Arrange.
            string expectedText = "Say hello world.";

            // Create an empty text file.
            DirectoryInfo currentTestFolder = CreateTestFolder(Path.GetRandomFileName());
            string        testFileFullPath  = Path.Combine(currentTestFolder.FullName, "myTestFile.txt");

            File.WriteAllText(testFileFullPath, "");

            IDictionary <string, string> additionalCapabilities = new Dictionary <string, string>();

            additionalCapabilities.Add("appWorkingDir", currentTestFolder.FullName);
            additionalCapabilities.Add("appArguments", testFileFullPath);

            using (WindowsDriver <WindowsElement> driver = InstanceWebDriver(additionalCapabilities))
            {
                // Act.
                WindowsElement editTextBox = driver.FindElementByClassName("Edit");
                editTextBox.SendKeys(expectedText);

                editTextBox.Click();

                // TODO: Fix SAVE Key combination.
                driver.Keyboard.PressKey(Keys.Control + "G" + Keys.Control);

                // Assert.
                Assert.AreEqual(expectedText, editTextBox.Text, $"The expected text was '{expectedText}' but found '{editTextBox.Text}'.");
            }
        }
Пример #10
0
        public static void ClassInitialize(TestContext context)
        {
            session = Utility.CreateNewSession(CommonTestSettings.NotepadAppId);
            Assert.IsNotNull(session);

            editBox = session.FindElementByClassName("Edit");
            Assert.IsNotNull(editBox);
        }
Пример #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LastOnboardingScreen"/> class.
        /// </summary>
        /// <param name="vpnSession">VPN session.</param>
        /// <param name="viewClassName">onboarding screen view class name.</param>
        public LastOnboardingScreen(WindowsDriver <WindowsElement> vpnSession)
        {
            var onboardingView = vpnSession.FindElementByClassName("OnboardingView4");
            var textBlocks     = onboardingView.FindElementsByClassName("TextBlock");

            Assert.IsTrue(textBlocks.Count > 2);
            this.closeButton      = vpnSession.FindElementByName("Close");
            this.image            = vpnSession.FindElementByClassName("Image");
            this.title            = textBlocks[0];
            this.subtitle         = textBlocks[1];
            this.getStartedButton = vpnSession.FindElementByName("Get started");
            Assert.IsNotNull(this.closeButton);
            Assert.IsNotNull(this.image);
            Assert.IsNotNull(this.title);
            Assert.IsNotNull(this.subtitle);
            Assert.IsNotNull(this.getStartedButton);
        }
Пример #12
0
 public MainPageObject SelectAlarmListItem(string name)
 {
     WaitForElementById(10, SELECT_ALARM_LIST);
     driver.FindElementByAccessibilityId(SELECT_ALARM_LIST).Click();
     WaitForElementById(10, ALARM_ITEM);
     driver.FindElementByClassName(ALARM_ITEM).FindElementByName(name).Click();
     return(this);
 }
Пример #13
0
        /// <summary>
        /// Wraps the WindowsDriver.FindElementByClassName and adds retry logic for when the element cannot be found due to WinAppDriver losing the window.
        /// If FindElementByAccessibilityId fails for a different reason rethrow the error.
        /// </summary>
        public static WindowsElement TryFindElementByClassName(this WindowsDriver <WindowsElement> driver, string name)
        {
            try
            {
                return(driver.FindElementByClassName(name));
            }
            catch (WebDriverException ex)
            {
                if (ex.Message.Contains("Currently selected window has been closed"))
                {
                    driver.SwitchToCurrentWindowHandle();
                    return(driver.FindElementByClassName(name));
                }

                throw;
            }
        }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoveDevicePopup"/> class.
        /// </summary>
        /// <param name="desktopSession">VPN session.</param>
        public RemoveDevicePopup(WindowsDriver <WindowsElement> desktopSession)
        {
            var removeDevicePopup = desktopSession.FindElementByClassName("Popup");

            this.removeButton = removeDevicePopup.FindElementByName("Remove");
            this.cancelButton = removeDevicePopup.FindElementByName("Ok");
            this.title        = removeDevicePopup.FindElementByAccessibilityId("Title");
            this.message      = removeDevicePopup.FindElementByAccessibilityId("Message");
        }
Пример #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LandingScreen"/> class.
        /// </summary>
        /// <param name="vpnSession">VPN session.</param>
        public LandingScreen(WindowsDriver <WindowsElement> vpnSession)
        {
            WindowsElement landingView = vpnSession.FindElementByClassName("LandingView");
            var            titles      = landingView.FindElementsByClassName("TextBlock");

            this.titleElement       = titles[0];
            this.subTitleElement    = titles[1];
            this.getStartedButton   = landingView.FindElementByName("Get started");
            this.learnMoreHyperlink = landingView.FindElementByName("Learn more");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="VerifyAccountScreen"/> class.
        /// </summary>
        /// <param name="vpnSession">VPN session.</param>
        public VerifyAccountScreen(WindowsDriver <WindowsElement> vpnSession)
        {
            WindowsElement landingView = vpnSession.FindElementByClassName("VerifyAccountView");
            var            titles      = landingView.FindElementsByClassName("TextBlock");

            this.titleElement         = titles[0];
            this.cancelTryAgainButton = titles[1];
            this.spinner = landingView.FindElementByClassName("Spinner");
            Assert.IsNotNull(this.spinner);
        }
Пример #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OnboardingScreen"/> class.
        /// </summary>
        /// <param name="vpnSession">VPN session.</param>
        /// <param name="viewClassName">onboarding screen view class name.</param>
        public OnboardingScreen(WindowsDriver <WindowsElement> vpnSession, string viewClassName)
        {
            var onboardingView = vpnSession.FindElementByClassName(viewClassName);
            var textBlocks     = onboardingView.FindElementsByClassName("TextBlock");

            Assert.IsTrue(textBlocks.Count > 3);
            this.closeButton = vpnSession.FindElementByName("Close");
            this.skip        = textBlocks[0];
            this.image       = vpnSession.FindElementByClassName("Image");
            this.title       = textBlocks[1];
            this.subtitle    = textBlocks[2];
            this.nextButton  = vpnSession.FindElementByName("Next");
            Assert.IsNotNull(this.closeButton);
            Assert.IsNotNull(this.skip);
            Assert.IsNotNull(this.image);
            Assert.IsNotNull(this.title);
            Assert.IsNotNull(this.subtitle);
            Assert.IsNotNull(this.nextButton);
        }
Пример #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GetHelpScreen"/> class.
        /// </summary>
        /// <param name="vpnSession">VPN session.</param>
        public GetHelpScreen(WindowsDriver <WindowsElement> vpnSession)
        {
            var getHelpView = vpnSession.FindElementByClassName("GetHelpView");

            this.backButton        = getHelpView.FindElementByName("Back");
            this.title             = getHelpView.FindElementByName("Get help");
            this.contactUs         = getHelpView.FindElementByName("Contact us");
            this.contactUsButton   = getHelpView.FindElementByName("Open Contact us link");
            this.helpSupport       = getHelpView.FindElementByName("Help & Support");
            this.helpSupportButton = getHelpView.FindElementByName("Open Help & Support link");
        }
Пример #19
0
        public static void ClassInitialize(TestContext context)
        {
            DesiredCapabilities appCapabilities = new DesiredCapabilities();

            appCapabilities.SetCapability("app", CommonTestSettings.NotepadAppId);
            session = new WindowsDriver <WindowsElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appCapabilities);
            Assert.IsNotNull(session);
            Assert.IsNotNull(session.SessionId);

            editBox = session.FindElementByClassName("Edit");
            Assert.IsNotNull(editBox);
        }
Пример #20
0
        // Helper function to use the SplitViewPane to navigate to a control test page
        protected static void NavigateTo(string ControlsGroup, string ControlName)
        {
            Assert.IsNotNull(session);
            session.FindElementByAccessibilityId("splitViewToggle").Click();
            System.Threading.Thread.Sleep(1000);

            var splitViewPane = session.FindElementByClassName("SplitViewPane");

            splitViewPane.FindElementByName(ControlsGroup).Click();
            splitViewPane.FindElementByName(ControlName).Click();
            System.Threading.Thread.Sleep(1000);
        }
Пример #21
0
 public void Setup(string appid, string name)
 {
     if (session == null)
     {
         session = TestHelper.GetSession(appid, name);
         // Set implicit timeout to 1.5 seconds to make element search to retry every 500 ms for at most three times
         session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1.5);
         inkCanvas       = session.FindElementByClassName("InkCanvas");
         recognizeButton = session.FindElementByName("Recognize");
         clearButton     = session.FindElementByXPath("//Button[@AutomationId=\"clearButton\"]");
         numberLabel     = session.FindElementByAccessibilityId("numberLabel");
     }
 }
Пример #22
0
        public void EnterText()
        {
            // Enter text into the edit field
            var editBox = NotepadSession.FindElementByClassName("Edit");

            editBox.SendKeys(TextValue);
            Assert.AreEqual(TextValue, editBox.Text);

            // Enter TimeStamp
            NotepadSession.FindElementByName("Edit").Click();
            NotepadSession.FindElementByName("Time/Date").Click();
            Assert.AreNotEqual(TextValue, editBox.Text);
        }
Пример #23
0
        public void TestNotepad()
        {
            // Launch Notepad
            DesiredCapabilities appCapabilities = new DesiredCapabilities();

            appCapabilities.SetCapability("app", @"C:\Windows\System32\notepad.exe");
            appCapabilities.SetCapability("appArguments", @"MyTestFile.txt");
            appCapabilities.SetCapability("appWorkingDir", @"C:\temp\");
            var NotepadSession = new WindowsDriver <WindowsElement>(new Uri("http://127.0.0.1:4723"), appCapabilities);

// Use the session to control the app
            NotepadSession.FindElementByClassName("Edit").SendKeys("This is some text");
        }
Пример #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainScreen"/> class.
        /// </summary>
        /// <param name="vpnSession">VPN session.</param>
        public MainScreen(WindowsDriver <WindowsElement> vpnSession)
        {
            this.titleElement    = Utils.WaitUntilFindElement(vpnSession.FindElementByClassName, "HeroText");
            this.subtitleElement = vpnSession.FindElementByClassName("HeroSubText");
            var settingButtons = vpnSession.FindElementsByName("Settings");

            this.vpnOffSettingButton = settingButtons[0];
            this.vpnOnSettingButton  = settingButtons[1];
            this.vpnSwitch           = vpnSession.FindElementByName("Toggle");
            this.serverListButton    = vpnSession.FindElementByAccessibilityId("ConnectionNavButton");
            this.deviceListButton    = vpnSession.FindElementByName("My devices");
            this.vpnStatus           = vpnSession.FindElementByName("VPN status");
        }
Пример #25
0
        public void EnterText(string inputtext)
        {
            // Enter text into the edit field
            var editBox = NotepadSession.FindElementByClassName("Edit");

            // Clear the edit field of any values
            editBox.SendKeys(inputtext);
            Assert.AreEqual(inputtext, editBox.Text);

            // Enter TimeStamp
            NotepadSession.FindElementByName("Edit").Click();
            NotepadSession.FindElementByName("Time/Date").Click();
            Assert.AreNotEqual(inputtext, editBox.Text);
        }
Пример #26
0
        public static void TearDown()
        {
            // Close Notepad
            NotepadSession.Quit();
            NotepadSession = null;

            // Launch Windows Explorer to delete the saved text file above
            DesiredCapabilities appCapabilities = new DesiredCapabilities();

            appCapabilities.SetCapability("app", ExplorerAppId);
            appCapabilities.SetCapability("deviceName", "WindowsPC");
            WindowsDriver <WindowsElement> WindowsExplorerSession = new WindowsDriver <WindowsElement>(new Uri(AppDriverUrl), appCapabilities);

            Assert.IsNotNull(WindowsExplorerSession);

            // Create Desktop session to control context menu and access dialogs
            DesiredCapabilities desktopCapabilities = new DesiredCapabilities();

            desktopCapabilities.SetCapability("app", "Root");
            desktopCapabilities.SetCapability("deviceName", "WindowsPC");
            WindowsDriver <WindowsElement> DesktopSession = new WindowsDriver <WindowsElement>(new Uri(AppDriverUrl), desktopCapabilities);

            Assert.IsNotNull(DesktopSession);

            // Navigate Windows Explorer to the target save location folder
            Thread.Sleep(1000);                                                         // Wait for 1 second
            var addressBandRoot = WindowsExplorerSession.FindElementByClassName("Address Band Root");
            var addressToolbar  = addressBandRoot.FindElementByAccessibilityId("1001"); // Address Band Toolbar

            WindowsExplorerSession.Mouse.Click(addressToolbar.Coordinates);
            addressBandRoot.FindElementByAccessibilityId("41477").SendKeys(TargetSaveLocation + OpenQA.Selenium.Keys.Enter);

            // Locate the saved test file
            WindowsExplorerSession.FindElementByAccessibilityId("SearchEditBox").SendKeys(TestFileName);

            // Delete the located saved test file
            Thread.Sleep(1000); // Wait for 1 second
            var shellFolderView = WindowsExplorerSession.FindElementByName("Shell Folder View");
            var targetFileItem  = shellFolderView.FindElementByName("NotepadTestOutputFile.txt");

            Assert.IsNotNull(targetFileItem);
            WindowsExplorerSession.Mouse.Click(targetFileItem.Coordinates);
            WindowsExplorerSession.Keyboard.SendKeys(OpenQA.Selenium.Keys.Delete);
            WindowsExplorerSession.Keyboard.SendKeys(OpenQA.Selenium.Keys.Escape);

            WindowsExplorerSession.Quit();
            WindowsExplorerSession = null;
            DesktopSession.Quit();
            DesktopSession = null;
        }
        public AppiumWpfPageObjectBase Start(string filename, string windowsApplicationDriverUrl = "http://127.0.0.1:4723")
        {
            DesiredCapabilities appCapabilities = new DesiredCapabilities();

            appCapabilities.SetCapability("app", filename);
            appCapabilities.SetCapability("platformName", "Windows");
            appCapabilities.SetCapability("deviceName", "WindowsPC");

            Session       = new WindowsDriver <WindowsElement>(new Uri(windowsApplicationDriverUrl), appCapabilities);
            SearchContext = Session.FindElementByClassName("Window");
            Session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(4);

            return(this);
        }
Пример #28
0
        public void TypeSmthAndAssert()
        {
            var appCapabilities = new DesiredCapabilities();

            appCapabilities.SetCapability("app", NotepadAppId);

            _driver = new WindowsDriver <WindowsElement>(new Uri(WinAppDriverUrl), appCapabilities);
            _driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
            _driver.Manage().Window.Maximize();

            _notepad = new NotepadView(_driver);
            _notepad.TypeAndChangeFont();
            Assert.AreEqual("bla-bla-bla, Radinovo 2018", _driver.FindElementByClassName("Edit").Text);
        }
Пример #29
0
        [TestMethod] public void 輸入帳號密碼_按下登入_預期得到一個彈跳視窗並呈現Hiyao()
        {
            WindowsDriver.FindElementByAccessibilityId("Id_TextBox").SendKeys("yao");
            WindowsDriver.FindElementByAccessibilityId("Password_TextBox").SendKeys("123456");
            WindowsDriver.FindElementByAccessibilityId("Login_Button").Click();

            var messageBox  = WindowsDriver.FindElementByClassName("#32770");
            var title       = messageBox.Text;
            var messageText = messageBox.FindElementByXPath("//Text[@Name='Hi~yao']").Text;

            Assert.AreEqual("Title", title);
            Assert.AreEqual("Hi~yao", messageText);

            WindowsDriver.FindElementByXPath("//Button[@Name='OK']").Click();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationsScreen"/> class.
        /// </summary>
        /// <param name="vpnSession">VPN session.</param>
        public NotificationsScreen(WindowsDriver <WindowsElement> vpnSession)
        {
            var notificationsView = vpnSession.FindElementByClassName("NotificationsView");

            this.backButton = notificationsView.FindElementByName("Back");
            this.title      = notificationsView.FindElementByName("Notifications");
            var notificationsPane = notificationsView.FindElementByClassName("ScrollViewer");

            this.unsecuredNetworkAlertCheckBox = notificationsPane.FindElementByName("Unsecured network alert");
            this.guestWifiPortalAlertCheckBox  = notificationsPane.FindElementByName("Guest Wi-Fi portal alert");
            var textBlocks = notificationsPane.FindElementsByClassName("TextBlock");

            this.unsecuredNetworkAlertDescription = textBlocks[0];
            this.guestWifiPortalAlertDescription  = textBlocks[1];
        }