public void PasswordTests()
        {
            HtmlDiv bodyContainerDiv = new HtmlDiv(this.window);

            bodyContainerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "layoutBodyContainer");

            // no fieldset available
            HtmlControl fieldset = new HtmlCustom(bodyContainerDiv);

            fieldset.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "fieldset");

            HtmlEdit passwordInput = new HtmlEdit(fieldset);

            passwordInput.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "passwordInput");

            Assert.IsTrue(passwordInput.TryFind());

            try
            {
                passwordInput.EnsureClickable();
            }
            catch { }

            Point p;

            Assert.IsTrue(passwordInput.TryGetClickablePoint(out p), "There should be a point on screen for the disabled input.");


            passwordInput.Text = "myPassword";
        }
Example #2
0
        public RegistrationControlPageObject SetFormValues(string username, string password, string confirmPassword)
        {
            HtmlDiv usernamePasswordDiv = new HtmlDiv(this.RegistrationDiv);

            HtmlEdit usernameDiv = new HtmlEdit(usernamePasswordDiv);

            usernameDiv.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "username", PropertyExpressionOperator.Contains);

            if (null != username)
            {
                usernameDiv.Text = username;
            }

            HtmlEdit passwordDiv = new HtmlEdit(usernamePasswordDiv);

            passwordDiv.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "password", PropertyExpressionOperator.Contains);

            if (null != password)
            {
                passwordDiv.Text = password;
            }

            if (null != confirmPassword)
            {
                this.ConfirmPasswordEdit.Text = confirmPassword;
            }

            return(this);
        }
Example #3
0
        public void ConfirmPasswordNotVisibleWhenCredentialsNotSet()
        {
            HtmlDiv registerDiv = new HtmlDiv(this.window);

            registerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "registerControl", PropertyExpressionOperator.EqualTo);

            SetFormValues(registerDiv, "a", "b", String.Empty);
            SetFormValues(registerDiv, String.Empty, String.Empty, null);

            // demo: duplicate code definition for finding this input
            HtmlEdit confirmPasswordDiv = new HtmlEdit(registerDiv);

            confirmPasswordDiv.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "confirmPassword", PropertyExpressionOperator.Contains);

            // demo: who can actually read these assertions ?!
            Assert.IsTrue(confirmPasswordDiv.Width == 0 && confirmPasswordDiv.Height == 0);

            SetFormValues(registerDiv, "mike", null, null);
            Assert.IsTrue(confirmPasswordDiv.Width == 0 && confirmPasswordDiv.Height == 0);

            SetFormValues(registerDiv, null, "pass", null);
            Assert.IsFalse(confirmPasswordDiv.Width == 0 && confirmPasswordDiv.Height == 0);

            SetFormValues(registerDiv, String.Empty, null, null);
            Assert.IsTrue(confirmPasswordDiv.Width == 0 && confirmPasswordDiv.Height == 0);
        }
Example #4
0
        //public void test()
        //{
        //    WinWindow win = this.UIWindowsSecurityWindow2;

        //    if (!win.Exists)
        //        Assert.Fail("no window");
        //    Keyboard.SendKeys(win, "Bus Sys");
        //    Keyboard.SendKeys(win, "{Tab}");
        //    Keyboard.SendKeys(win, Playback.EncryptText("Tottenham1"));

        //    Keyboard.SendKeys(win, "Tottenham1");
        //    Playback.EncryptText("{Enter}");

        //}

        /// <summary>
        /// MotoCreateSiteRenewal - Use 'MotoCreateSiteRenewalParams' to pass parameters into this method.
        /// </summary>
        public void MotoCreateSiteRenewal()
        {
            #region Variable Declarations
            HtmlHyperlink   uICreateaMotorTestReneHyperlink = this.UIInsurEcomSystemMaintWindow.UILeftbarFrame.UIInsurEcomLeftbarDocument1.UIDivRenewalsPane.UICreateaMotorTestReneHyperlink;
            HtmlComboBox    uIInsurerIDComboBox             = this.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UIInsurerIDComboBox;
            HtmlEdit        uITxtPolicyNumberEdit           = this.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UITxtPolicyNumberEdit;
            HtmlEdit        uITxtAutoLapseDateEdit1         = this.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UITxtAutoLapseDateEdit1;
            HtmlInputButton uICreateRecordButton            = this.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UICreateRecordButton;
            BrowserWindow   uIInsurEcomSystemMaintWindow    = this.UIInsurEcomSystemMaintWindow;
            HtmlEdit        uITxtRenewalDateEdit            = this.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UITxtRenewalDateEdit;
            #endregion

            // Click 'Create a Motor Test Renewal Invitation' link
            Mouse.Click(uICreateaMotorTestReneHyperlink, new Point(50, 22));

            // Select 'Highway Insurance' in 'InsurerID' combo box
            uIInsurerIDComboBox.SelectedItem = this.MotoCreateSiteRenewalParams.UIInsurerIDComboBoxSelectedItem;

            // Type '7071000841' in 'txtPolicyNumber' text box
            uITxtPolicyNumberEdit.Text = this.MotoCreateSiteRenewalParams.UITxtPolicyNumberEditText;

            // Type '12/11/2012' in 'txtAutoLapseDate' text box
            uITxtAutoLapseDateEdit1.Text = uITxtRenewalDateEdit.GetProperty("Text").ToString();

            // Click 'Create Record' button
            Mouse.Click(uICreateRecordButton, new Point(112, 11));

            // Click 'Ok' button in the browser dialog window
            uIInsurEcomSystemMaintWindow.PerformDialogAction(BrowserDialogAction.Ok);
        }
Example #5
0
        protected static void SetFormValues(HtmlDiv registerDiv, string username, string password, string confirmPassword)
        {
            HtmlDiv usernamePasswordDiv = new HtmlDiv(registerDiv);

            HtmlEdit usernameDiv = new HtmlEdit(usernamePasswordDiv);

            usernameDiv.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "username", PropertyExpressionOperator.Contains);

            if (null != username)
            {
                usernameDiv.Text = username;
            }

            HtmlEdit passwordDiv = new HtmlEdit(usernamePasswordDiv);

            passwordDiv.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "password", PropertyExpressionOperator.Contains);

            if (null != password)
            {
                passwordDiv.Text = password;
            }

            HtmlEdit confirmPasswordDiv = new HtmlEdit(registerDiv);

            confirmPasswordDiv.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "confirmPassword", PropertyExpressionOperator.Contains);

            if (null != confirmPassword)
            {
                confirmPasswordDiv.Text = confirmPassword;
            }
        }
        public static void ecs_login_test()
        {
            BrowserWindow browser = BrowserWindow.Launch("https://www.ecs.csus.edu/index.php?content=ecs_portal");

            browser.Maximized = true;

            HtmlDocument doc = new HtmlDocument(browser);

            doc.FilterProperties[HtmlDocument.PropertyNames.Title] = "ECS Portal | Sacramento State | College of Engineering & Computer Science | Sacra" +
                                                                     "mento State";

            HtmlEdit loginTxt = new HtmlEdit(doc);

            loginTxt.SearchProperties[HtmlEdit.PropertyNames.Name] = "username";
            Keyboard.SendKeys(loginTxt, "Type your ECS username here");

            HtmlEdit passwordTxt = new HtmlEdit(doc);

            passwordTxt.SearchProperties[HtmlEdit.PropertyNames.Name] = "passwd";
            Keyboard.SendKeys(passwordTxt, "Type your ECS password here");

            HtmlInputButton loginButton = new HtmlInputButton(doc);

            loginButton.SearchProperties[HtmlButton.PropertyNames.Name] = "/portal_login";
            Mouse.Click(loginButton);

            Playback.Wait(10000);
            browser.Close();
        }
Example #7
0
        public void search()
        {
            HtmlEdit hedit = this.UINationalandLocalWeatWindow.UINationalandLocalWeatDocument.UISearchcityziporplaceEdit;

            Keyboard.SendKeys(hedit, "New York");
            //Keyboard.SendKeys("Enter")
        }
        /// <summary>
        /// addNewCar - Use 'addNewCarParams' to pass parameters into this method.
        /// </summary>
        public void addNewCar()
        {
            #region Variable Declarations
            HtmlHyperlink   uIPojazdyHyperlink   = this.UIIndexMyASPNETApplicaWindow.UIIndexMyASPNETApplicaDocument.UIBsexamplenavbarcollaPane.UIPojazdyHyperlink;
            HtmlHyperlink   uICreateNewHyperlink = this.UIIndexMyASPNETApplicaWindow.UIIndexMyASPNETApplicaDocument1.UICreateNewHyperlink;
            HtmlEdit        uIModelEdit          = this.UIIndexMyASPNETApplicaWindow.UICreateMyASPNETApplicDocument.UIModelEdit;
            HtmlEdit        uIRokprodukcjiEdit   = this.UIIndexMyASPNETApplicaWindow.UICreateMyASPNETApplicDocument.UIRokprodukcjiEdit;
            HtmlEdit        uIVinEdit            = this.UIIndexMyASPNETApplicaWindow.UICreateMyASPNETApplicDocument.UIVinEdit;
            HtmlInputButton uICreateButton       = this.UIIndexMyASPNETApplicaWindow.UICreateMyASPNETApplicDocument.UICreateButton;
            #endregion

            // Click 'Pojazdy' link
            Mouse.Click(uIPojazdyHyperlink, new Point(44, 32));

            // Click 'Create New' link
            Mouse.Click(uICreateNewHyperlink, new Point(56, 6));

            // Type 'Bmw' in 'Model' text box
            uIModelEdit.Text = this.addNewCarParams.UIModelEditText;

            // Type '{Tab}' in 'Model' text box
            Keyboard.SendKeys(uIModelEdit, this.addNewCarParams.UIModelEditSendKeys, ModifierKeys.None);

            // Type '2016' in 'Rok produkcji' text box
            uIRokprodukcjiEdit.Text = this.addNewCarParams.UIRokprodukcjiEditText;

            // Type 'znxmskndut' in 'Vin' text box
            uIVinEdit.Text = this.addNewCarParams.UIVinEditText;

            // Click 'Create' button
            Mouse.Click(uICreateButton, new Point(36, 15));
        }
Example #9
0
        private static HtmlEdit GetHtmlEdit(string uiTitle, string uiType)
        {
            dynamic htmlControl = new HtmlEdit(Browser.Locate(uiTitle, uiType));

            htmlControl.TechnologyName = TechnologyNameWeb;
            return(htmlControl);
        }
Example #10
0
        public void Login()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.

            // IWebDriver driver = new ope();
            BrowserWindow.CurrentBrowser = "chrome";
            browserWindow = BrowserWindow.Launch(applink);
            HtmlEdit   username = new HtmlEdit(browserWindow);
            HtmlEdit   password = new HtmlEdit(browserWindow);
            HtmlButton btnlogin = new HtmlButton(browserWindow);

            username.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "username");
            password.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "password");
            btnlogin.SearchProperties.Add(HtmlButton.PropertyNames.Id, "btn_login");

            //enter username and password in fields1405726200
            Keyboard.SendKeys(username, "*****@*****.**");
            Playback.PlaybackSettings.DelayBetweenActions = 200;
            Keyboard.SendKeys(password, "Fgx1234!");
            Playback.PlaybackSettings.DelayBetweenActions = 200;
            Mouse.Click(btnlogin);


            OpenCashHouse();
        }
Example #11
0
        public void LocalAppLoginValidation()
        {
            BrowserWindow browser  = BrowserWindow.Launch("http://10.23.66.126:84/Login.aspx");
            HtmlEdit      uname    = new HtmlEdit(browser);
            HtmlEdit      pass     = new HtmlEdit(browser);
            HtmlButton    loginbtn = new HtmlButton(browser);


            uname.SearchProperties.Add("Id", "TextBox1");
            pass.SearchProperties.Add("Id", "TextBox2");

            loginbtn.SearchProperties.Add("Id", "Button1");
            loginbtn.SearchProperties.Add("TagName", "INPUT");


            //Keyboard.SendKeys(uname, "testname");
            //Keyboard.SendKeys(pass, "testpass");

            Mouse.Click(loginbtn);
            Playback.Wait(5000);
            if (uname.WaitForControlExist())
            {
                Console.WriteLine("Missing username and Password");
            }
            else
            {
                Console.WriteLine("User logged in even with Missing username and Password");
                Assert.Fail("Test failed");
            }
        }
Example #12
0
        public void LocalAppLoginTest()

        {
            // RD();
            BrowserWindow browser  = BrowserWindow.Launch("http://10.23.66.126:84/Login.aspx");
            HtmlEdit      uname    = new HtmlEdit(browser);
            HtmlEdit      pass     = new HtmlEdit(browser);
            HtmlButton    loginbtn = new HtmlButton(browser);


            uname.SearchProperties.Add("Id", "TextBox1");
            pass.SearchProperties.Add("Id", "TextBox2");

            loginbtn.SearchProperties.Add("Id", "Button1");
            loginbtn.SearchProperties.Add("TagName", "INPUT");


            Keyboard.SendKeys(uname, "testname");
            Keyboard.SendKeys(pass, "testpass");

            Mouse.Click(loginbtn);

            HtmlSpan labelHome = new HtmlSpan(browser);

            labelHome.SearchProperties.Add("InnerText", "Welcome");

            //labelHome.WaitForControlExist(45000);
            //HtmlButton close = new HtmlButton(browser);
            //close.SearchProperties.Add("FriendlyName", "Close");

            //Mouse.Click(close);
        }
Example #13
0
        public void MotoCreateSiteRenewal(string policyNumber, string renewalPremium, string insurer = "")
        {
            HtmlHyperlink uICreateaMotorTestReneHyperlink =
                map.UIInsurEcomSystemMaintWindow.UILeftbarFrame.UIInsurEcomLeftbarDocument.UIDivRenewalsPane.UICreateaMotorTestReneHyperlink;
            HtmlComboBox    uiInsurerIdComboBox          = map.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UIInsurerIDComboBox;
            HtmlEdit        uITxtPolicyNumberEdit        = map.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UITxtPolicyNumberEdit;
            HtmlEdit        uITxtAutoLapseDateEdit1      = map.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UITxtAutoLapseDateEdit1;
            HtmlInputButton uICreateRecordButton         = map.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UICreateRecordButton;
            HtmlEdit        uITxtPremiumEdit             = UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UITxtPremiumEdit;
            BrowserWindow   uIInsurEcomSystemMaintWindow = map.UIInsurEcomSystemMaintWindow;
            HtmlEdit        uITxtRenewalDateEdit         = map.UIInsurEcomSystemMaintWindow.UIContentFrame.UIInsurEcomMainPageDocument.UITxtRenewalDateEdit;

            Mouse.Click(uICreateaMotorTestReneHyperlink, new Point(50, 22));

            uiInsurerIdComboBox.SelectedItem = insurer == "" ? this.map.MotoCreateSiteRenewalParams.UIInsurerIDComboBoxSelectedItem : insurer;

            uITxtPolicyNumberEdit.Text = policyNumber;

            uITxtPremiumEdit.Text = renewalPremium;

            uITxtAutoLapseDateEdit1.Text = uITxtRenewalDateEdit.GetProperty("Text").ToString();

            Mouse.Click(uICreateRecordButton);

            uIInsurEcomSystemMaintWindow.PerformDialogAction(BrowserDialogAction.Ok);
        }
        /// <summary>
        /// ECS_login_RecordedMethod1 - Use 'ECS_login_RecordedMethod1Params' to pass parameters into this method.
        /// </summary>
        public void ECS_login_RecordedMethod1()
        {
            #region Variable Declarations
            HtmlEdit        uIUserNameEdit = this.UIECSPortalSacramentoSWindow.UIECSPortalSacramentoSDocument1.UIUserNameEdit;
            HtmlEdit        uIPasswordEdit = this.UIECSPortalSacramentoSWindow.UIECSPortalSacramentoSDocument1.UIPasswordEdit;
            HtmlInputButton uILoginButton  = this.UIECSPortalSacramentoSWindow.UIECSPortalSacramentoSDocument1.UILoginButton;
            #endregion

            // Last mouse action was not recorded.

            // Type 'palaniss' in 'User Name :' text box
            uIUserNameEdit.Text = this.ECS_login_RecordedMethod1Params.UIUserNameEditText;

            // Type '{Tab}' in 'User Name :' text box
            Keyboard.SendKeys(uIUserNameEdit, this.ECS_login_RecordedMethod1Params.UIUserNameEditSendKeys, ModifierKeys.None);

            // Type '********' in 'Password :'******'{Tab}' in 'Password :'******'{Enter}' in 'Login >>' button
            Keyboard.SendKeys(uILoginButton, this.ECS_login_RecordedMethod1Params.UILoginButtonSendKeys, ModifierKeys.None);
        }
Example #15
0
        private void SetValue(string value, string id)
        {
            HtmlEdit edit = new HtmlEdit(BrowserManager.Instance.Browser);

            edit.SearchProperties.Add(HtmlEdit.PropertyNames.Id, id);
            Keyboard.SendKeys(edit, value);
        }
        /// <summary>
        /// Se prueba los componentes principales de la interfaz de creación de formulario
        /// </summary>
        public void PruebaInterfazBaseDeCrearFormulario()
        {
            #region Variable Declarations
            HtmlEdit        uICódigorequeridoEdit           = this.UILocalhost44334BingInWindow.UISistemadeMejoramientDocument1.UICódigorequeridoEdit;
            HtmlInputButton uIAgregarseccionesButton        = this.UILocalhost44334BingInWindow.UISistemadeMejoramientDocument1.UIAgregarseccionesButton;
            HtmlDiv         uIAúnnohaagregadosecciPane1     = this.UILocalhost44334BingInWindow.UISistemadeMejoramientDocument1.UIAúnnohaagregadosecciPane.UIAúnnohaagregadosecciPane1;
            HtmlDiv         uICambiossinguardarPane         = this.UILocalhost44334BingInWindow.UISistemadeMejoramientDocument1.UICambiossinguardarPane;
            HtmlHyperlink   uIVolveralbancodeformuHyperlink = this.UILocalhost44334BingInWindow.UISistemadeMejoramientDocument1.UIVolveralbancodeformuHyperlink;
            #endregion

            // Verify that the 'Id' property of 'Código requerido' text box equals 'textCode'
            Assert.AreEqual(this.PruebaInterfazBaseDeCrearFormularioExpectedValues.UICódigorequeridoEditId, uICódigorequeridoEdit.Id, "No se solicita el código del formulario");

            // Verify that the 'Id' property of 'Agregar secciones' button equals 'AgregarSeccion'
            Assert.AreEqual(this.PruebaInterfazBaseDeCrearFormularioExpectedValues.UIAgregarseccionesButtonId, uIAgregarseccionesButton.Id, "No aparece el botón de Agregar Secciones");

            // Verify that the 'InnerText' property of 'Aún no ha agregado secciones' pane equals 'Aún no ha agregado secciones'
            Assert.AreEqual(this.PruebaInterfazBaseDeCrearFormularioExpectedValues.UIAúnnohaagregadosecciPane1InnerText, uIAúnnohaagregadosecciPane1.InnerText, "No se notifica que no se han agregado secciones");

            // Verify that the 'InnerText' property of 'Cambios sin guardar' pane equals 'Cambios sin guardar '
            Assert.AreEqual(this.PruebaInterfazBaseDeCrearFormularioExpectedValues.UICambiossinguardarPaneInnerText, uICambiossinguardarPane.InnerText, "No se indica que hay cambios sin guardar antes de ingresar el código y el nombre " +
                            "del formulario.");

            // Verify that the 'InnerText' property of 'Volver al banco de formularios' link equals 'Volver al banco de formularios'
            Assert.AreEqual(this.PruebaInterfazBaseDeCrearFormularioExpectedValues.UIVolveralbancodeformuHyperlinkInnerText, uIVolveralbancodeformuHyperlink.InnerText, "No se muestra el botón de volver al banco de formularios");
        }
        private string getText(HtmlEdit editControl)
        {
            string text = editControl.Text;

            Debug.WriteLine(editControl.Id + ": " + text);
            return(text);
        }
Example #18
0
        public void SetText_OnHtmlEdit_Succeeds()
        {
            //Arrange
            using (TempFile tempFile = new TempFile(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <div id=""div1"">
            <input type=""text""/>
        </div>
    </body>
</html>"))
            {
                BrowserWindow.Launch(tempFile.FilePath);
                var      window       = new BrowserWindowUnderTest("test");
                HtmlDiv  div          = window.Find <HtmlDiv>(By.Id("div1"));
                HtmlEdit inputTextBox = div.Find <HtmlEdit>();

                //Act
                inputTextBox.Text = "text";

                //Assert
                Assert.AreEqual("text", inputTextBox.Text);

                window.Close();
            }
        }
Example #19
0
        public WebEdit(List <UIProperty> controlProps)
        {
            BrowserWindow window = this.GetBrowser(controlProps);

            webedit = new HtmlEdit(window);
            controlProps.ForEach(property => webedit.SearchProperties[property.PropertyName] = property.PropertyValue);
        }
Example #20
0
        /// <summary>
        /// EntercustomerdetailsFirstNameLastNameStreetCityStateZip - Test Case 244 - Use 'EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams' to pass parameters into this method.
        /// </summary>
        public void EntercustomerdetailsFirstNameLastNameStreetCityStateZip()
        {
            #region Variable Declarations
            HtmlEdit   uIFirstNameEdit = this.UICreateWindowsInterneWindow.UICreateDocument.UIFirstNameEdit;
            HtmlEdit   uILastNameEdit  = this.UICreateWindowsInterneWindow.UICreateDocument.UILastNameEdit;
            HtmlEdit   uIStreetEdit    = this.UICreateWindowsInterneWindow.UICreateDocument.UIStreetEdit;
            HtmlEdit   uICityEdit      = this.UICreateWindowsInterneWindow.UICreateDocument.UICityEdit;
            HtmlEdit   uIStateEdit     = this.UICreateWindowsInterneWindow.UICreateDocument.UIStateEdit;
            HtmlEdit   uIZipEdit       = this.UICreateWindowsInterneWindow.UICreateDocument.UIZipEdit;
            HtmlCustom uIItemCustom    = this.UICreateWindowsInterneWindow.UICreateDocument.UIContentCustom.UIItemCustom;
            #endregion

            // Type 'Brian' in 'First Name' text box
            uIFirstNameEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UIFirstNameEditText;

            // Type 'Keller' in 'Last Name' text box
            uILastNameEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UILastNameEditText;

            // Type '361 North Avenue' in 'Street' text box
            uIStreetEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UIStreetEditText;

            // Type 'Redmond' in 'City' text box
            uICityEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UICityEditText;

            // Type 'WA' in 'State' text box
            uIStateEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UIStateEditText;

            // Type '98052' in 'Zip' text box
            uIZipEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UIZipEditText;

            // Click custom control
            Mouse.Click(uIItemCustom, new Point(199, 586));
        }
Example #21
0
        private void ClearForm(string id)
        {
            HtmlEdit edit = new HtmlEdit(BrowserManager.Instance.Browser);

            edit.SearchProperties.Add(HtmlEdit.PropertyNames.Id, id);
            edit.Text = "";
        }
        /// <summary>
        /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method.
        /// </summary>
        public void RecordedMethod1()
        {
            #region Variable Declarations
            WinButton       uISearchthewebandWindoButton = this.UISearchthewebandWindoWindow.UISearchthewebandWindoButton;
            BrowserWindow   uINewtabInternetExplorWindow = this.UINewtabInternetExplorWindow;
            HtmlEdit        uIInputNumberEdit            = this.UINewtabInternetExplorWindow.UIHomePageMyASPNETApplDocument.UIInputNumberEdit;
            HtmlInputButton uISubmitButton = this.UINewtabInternetExplorWindow.UIHomePageMyASPNETApplDocument.UISubmitButton;
            #endregion

            // Click 'Search the web and Windows' button
            Mouse.Click(uISearchthewebandWindoButton, new Point(152, 4));

            // To test Windows Store apps, use the Coded UI Test project template for Windows Store apps under the Windows Store node.

            // To test Windows Store apps, use the Coded UI Test project template for Windows Store apps under the Windows Store node.

            // To test Windows Store apps, use the Coded UI Test project template for Windows Store apps under the Windows Store node.

            // To test Windows Store apps, use the Coded UI Test project template for Windows Store apps under the Windows Store node.

            // Go to web page 'http://localhost/test/'
            uINewtabInternetExplorWindow.NavigateToUrl(new System.Uri(this.RecordedMethod1Params.UINewtabInternetExplorWindowUrl));

            // Type '20' in 'Input Number' text box
            uIInputNumberEdit.Text = this.RecordedMethod1Params.UIInputNumberEditText;

            // Type '{Enter}' in 'Input Number' text box
            Keyboard.SendKeys(uIInputNumberEdit, this.RecordedMethod1Params.UIInputNumberEditSendKeys, ModifierKeys.None);

            // Type '20' in 'Input Number' text box
            uIInputNumberEdit.Text = this.RecordedMethod1Params.UIInputNumberEditText1;

            // Click 'Submit' button
            Mouse.Click(uISubmitButton, new Point(32, 27));
        }
Example #23
0
        public void EnterText(UITestControl parent, string id, string value)
        {
            var edit = new HtmlEdit(parent);

            edit.SearchProperties.Add(HtmlEdit.PropertyNames.Id, id);
            edit.Text = value;
        }
        /// <summary>
        /// RecordedLogin - Use 'RecordedLoginParams' to pass parameters into this method.
        /// </summary>
        public void RecordedLogin()
        {
            #region Variable Declarations
            WinEdit   uINameEdit     = this.UIDebugWindow.UIItemWindow.UIWindowsFormsApp1exeListItem.UINameEdit;
            HtmlEdit  uIUsernameEdit = this.UIForm1Window.UIItemClient.UIAboutblankDocument.UIUsernameEdit;
            HtmlEdit  uIPasswordEdit = this.UIForm1Window.UIItemClient.UIAboutblankDocument.UIPasswordEdit;
            WinButton uIOKButton     = this.UIOKWindow.UIOKButton;
            #endregion

            // Wait for 1 seconds for user delay between actions; Click 'Name' text box
            Playback.Wait(1000);
            Mouse.Click(uINameEdit, new Point(165, 19));

            // Type 'zyg' in 'username' text box
            uIUsernameEdit.Text = this.RecordedLoginParams.UIUsernameEditText;

            // Type '{Tab}' in 'username' text box
            Keyboard.SendKeys(uIUsernameEdit, this.RecordedLoginParams.UIUsernameEditSendKeys, ModifierKeys.None);

            // Type '********' in 'password' text box
            uIPasswordEdit.Password = this.RecordedLoginParams.UIPasswordEditPassword;

            // Click 'OK' button
            Mouse.Click(uIOKButton, new Point(88, 24));
        }
Example #25
0
        public void Launch_TempHtmlFileWithInputWithMaxLength_CanSetTextWhichExceedsMaxLength()
        {
            // Arrange
            using (var webPage = new TempWebPage(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <input id=""input"" type=""text"" maxlength=10 />
    </body>
</html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                HtmlEdit input = browserWindow.Find <HtmlEdit>(By.Id("input"));

                // Act
                string inputText  = "12345678901";
                string outputText = "1234567890";
                Keyboard.SendKeys(input.SourceControl, inputText);

                // Assert
                Assert.AreEqual(input.Text, outputText);

                browserWindow.Close();
            }
        }
Example #26
0
        public static void LoginDA(string userEmail = "", string userPwd = "")
        {
            Logger.log.Info("******  Start LoginDA() ********");

            if (userEmail == "")
            {
                userEmail = ConstantsUtil.defaultUserEmail;
            }
            if (userPwd == "")
            {
                userPwd = ConstantsUtil.defaultUserPwd;
            }

            Logger.log.Debug(" === LoginDA uses user email : " + userEmail.ToString());

            HtmlEdit credentialsEmailEdit = DesktopAppControls.GetCredentialsEmailEdit();

            HtmlEdit credentialsPasswordEdit = DesktopAppControls.GetCredentialsPasswordEdit();

            HtmlButton signInButton = DesktopAppControls.GetSignInButton();


            // Type '*****@*****.**' in 'credentials-email' text box
            credentialsEmailEdit.Text = userEmail;

            // Type '********' in 'credentials-password' text box
            credentialsPasswordEdit.Text = userPwd;

            // Click 'Sign In' button
            Mouse.Click(signInButton, new Point(218, 21));
            Thread.Sleep(10000);

            Logger.log.Info("******  End LoginDA() ********");
        }
Example #27
0
        /// <summary>
        /// Action_RemoveTheRequiredDataFieldsFromEmployeeDetails - Use 'Action_RemoveTheRequiredDataFieldsFromEmployeeDetailsParams' to pass parameters into this method.
        /// </summary>
        public void Action_RemoveTheRequiredDataFieldsFromEmployeeDetails()
        {
            #region Variable Declarations
            HtmlEdit     uICtl00ContentPlaceholEdit     = this.UIEmployeeDetailsPageWWindow.UIEmployeeDetailsPageDocument.UICtl00ContentPlaceholEdit;
            HtmlEdit     uICtl00ContentPlaceholEdit1    = this.UIEmployeeDetailsPageWWindow.UIEmployeeDetailsPageDocument.UICtl00ContentPlaceholEdit1;
            HtmlComboBox uICtl00ContentPlaceholComboBox = this.UIEmployeeDetailsPageWWindow.UIEmployeeDetailsPageDocument.UICtl00ContentPlaceholComboBox;
            HtmlEdit     uICtl00ContentPlaceholEdit2    = this.UIEmployeeDetailsPageWWindow.UIEmployeeDetailsPageDocument.UICtl00ContentPlaceholEdit2;
            HtmlEdit     uICtl00ContentPlaceholEdit3    = this.UIEmployeeDetailsPageWWindow.UIEmployeeDetailsPageDocument.UICtl00ContentPlaceholEdit3;
            HtmlEdit     uICtl00ContentPlaceholEdit4    = this.UIEmployeeDetailsPageWWindow.UIEmployeeDetailsPageDocument.UICtl00ContentPlaceholEdit4;
            HtmlEdit     uICtl00ContentPlaceholEdit5    = this.UIEmployeeDetailsPageWWindow.UIEmployeeDetailsPageDocument.UICtl00ContentPlaceholEdit5;
            #endregion

            // Type '' in 'ctl00$ContentPlaceholder1$formViewEmployee$txtFirs...' text box
            uICtl00ContentPlaceholEdit.Text = this.Action_RemoveTheRequiredDataFieldsFromEmployeeDetailsParams.UICtl00ContentPlaceholEditText;

            // Type '' in 'ctl00$ContentPlaceholder1$formViewEmployee$txtLast...' text box
            uICtl00ContentPlaceholEdit1.Text = this.Action_RemoveTheRequiredDataFieldsFromEmployeeDetailsParams.UICtl00ContentPlaceholEdit1Text;

            // Select 'None' in 'ctl00$ContentPlaceholder1$formViewEmployee$ddlCoun...' combo box
            uICtl00ContentPlaceholComboBox.SelectedItem = this.Action_RemoveTheRequiredDataFieldsFromEmployeeDetailsParams.UICtl00ContentPlaceholComboBoxSelectedItem;

            // Type '' in 'ctl00$ContentPlaceholder1$formViewEmployee$txtHire...' text box
            uICtl00ContentPlaceholEdit2.Text = this.Action_RemoveTheRequiredDataFieldsFromEmployeeDetailsParams.UICtl00ContentPlaceholEdit2Text;

            // Type '' in 'ctl00$ContentPlaceholder1$formViewEmployee$txtAddr...' text box
            uICtl00ContentPlaceholEdit3.Text = this.Action_RemoveTheRequiredDataFieldsFromEmployeeDetailsParams.UICtl00ContentPlaceholEdit3Text;

            // Type '' in 'ctl00$ContentPlaceholder1$formViewEmployee$txtHome...' text box
            uICtl00ContentPlaceholEdit4.Text = this.Action_RemoveTheRequiredDataFieldsFromEmployeeDetailsParams.UICtl00ContentPlaceholEdit4Text;

            // Click 'ctl00$ContentPlaceholder1$formViewEmployee$txtExte...' text box
            Mouse.Click(uICtl00ContentPlaceholEdit5, new Point(121, 19));
        }
Example #28
0
        public void SetText_OnHtmlEdit_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <div id=""div1"">
            <input type=""text""/>
        </div>
    </body>
</html>"))
            {
                var      browserWindow = BrowserWindow.Launch(webPage.FilePath);
                HtmlDiv  div           = browserWindow.Find <HtmlDiv>(By.Id("div1"));
                HtmlEdit inputTextBox  = div.Find <HtmlEdit>();

                //Act
                inputTextBox.Text = "text";

                //Assert
                Assert.AreEqual("text", inputTextBox.Text);

                browserWindow.Close();
            }
        }
Example #29
0
        public void CodedUITestMethod1()
        {
            BrowserWindow browser = BrowserWindow.Launch(new Uri("http://*****:*****@gmail.com");

            HtmlEdit Password_txtbox = new HtmlEdit(browser);

            Password_txtbox.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "Password");
            Password_txtbox.SetFocus();
            Keyboard.SendKeys("144685");

            HtmlEdit ConPassword_txtbox = new HtmlEdit(browser);

            ConPassword_txtbox.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "ConfirmPassword");
            ConPassword_txtbox.SetFocus();
            Keyboard.SendKeys("144685");
        }
Example #30
0
 /// <summary>
 /// Find the edit control on page
 /// </summary>
 private HtmlEdit FindEditControlOnPage(string textboxName)
 {
     var list = this.UILoginXeroAccountingSWindow.UILoginXeroAccountingSDocument;
     var customControl = new HtmlEdit(list);
     customControl.SearchProperties.Add(HtmlEdit.PropertyNames.Name, textboxName, PropertyExpressionOperator.Contains);
     return customControl;
 }
        public void AfterRegisteringNewUser_AccountSettingsIsShown()
        {
            HtmlDiv registerDiv = new HtmlDiv(this.window);

            registerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "registerControl", PropertyExpressionOperator.EqualTo);

            HtmlDiv usernamePasswordDiv = new HtmlDiv(registerDiv);

            HtmlEdit username = new HtmlEdit(usernamePasswordDiv);

            username.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "username", PropertyExpressionOperator.Contains);
            username.Text = Guid.NewGuid().ToString("N");

            HtmlEdit password = new HtmlEdit(usernamePasswordDiv);

            password.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "password", PropertyExpressionOperator.Contains);
            password.Text = "pass";

            HtmlEdit confirmPassword = new HtmlEdit(registerDiv);

            confirmPassword.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "confirmPassword", PropertyExpressionOperator.Contains);
            confirmPassword.Text = "pass";

            HtmlDiv accountSettingsDiv = new HtmlDiv(window);

            accountSettingsDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "accountSettingsControl");

            Assert.IsTrue(accountSettingsDiv.Width == 0 && accountSettingsDiv.Height == 0);

            HtmlButton submitRegisterButton = new HtmlButton(registerDiv);

            Mouse.Click(submitRegisterButton);

            Assert.IsFalse(accountSettingsDiv.Width == 0 && accountSettingsDiv.Height == 0);
        }
Example #32
0
        public static void EnterTextInSingleline(string fieldName, string text)
        {
            HtmlEdit Edit = new HtmlEdit(browserWindow);
            //Edit.SearchProperties.Add(HtmlEdit.PropertyNames.Type, "SINGLELINE", PropertyExpressionOperator.EqualTo);
            Edit.SearchProperties.Add(HtmlEdit.PropertyNames.Name, fieldName, PropertyExpressionOperator.EqualTo);
            Edit.FilterProperties.Add(HtmlEdit.PropertyNames.Id, fieldName, PropertyExpressionOperator.Contains);
            Edit.FilterProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, fieldName, PropertyExpressionOperator.Contains);

            //Edit.WaitForControlExist(Parameters.WAIT_FOR_CONTROL);
            Edit.WaitForControlExist();
            Edit.Text = text;
        }
Example #33
0
        public void HtmlEdit_Wrap_Succeeds()
        {
            GoogleHomePage pgGHomePage = BrowserWindowUnderTest.Launch<GoogleHomePage>("http://www.google.com");

            CUITControls.HtmlEdit tmp = new CUITControls.HtmlEdit(pgGHomePage);
            tmp.SearchProperties.Add("Id", "lst-ib");

            HtmlEdit txtEdit = new HtmlEdit();
            txtEdit.WrapReady(tmp);
            txtEdit.SetText("Coded UI Test enhanced Framework");
            GoogleSearch pgSearch = BrowserWindowUnderTest.GetBrowserWindow<GoogleSearch>();
            pgSearch.Close();
        }
        public void HtmlEdit_Wrap_Succeeds()
        {
            GoogleHomePage pgGHomePage = WebPage.Launch<GoogleHomePage>("http://www.google.com");

            var tmp = new HtmlEdit(pgGHomePage);
            tmp.SearchProperties.Add("Id", "lst-ib");

            var txtEdit = new EnhancedHtmlEdit();
            txtEdit.WrapReady(tmp);
            txtEdit.SetText("Coded UI Test enhanced Framework");
            GoogleSearch pgSearch = WebPage.GetPage<GoogleSearch>();
            pgSearch.Close();
        }
 private void AddValueToTextBox(UITestControl parent,int value)
 {
     var edit = new HtmlEdit(parent);
     edit.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "number");
     edit.Text = value.ToString();
 }
 private void SetValue(string value, string id)
 {
     HtmlEdit edit = new HtmlEdit(BrowserManager.Instance.Browser);
     edit.SearchProperties.Add(HtmlEdit.PropertyNames.Id, id);
     Keyboard.SendKeys(edit, value);
 }
        public UITestControl SurfaceParameterControl(string SurfaceParameterControl)
        {
            WinClient Client = new WinClient(GetMainWindow());
            Client.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server";
            Client.SearchProperties[WinControl.PropertyNames.Instance] = "3";
            Client.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument Documento = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(Client);
            Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = "awb_surfaceparams.htm";
            Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False";
            Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False";
            Documento.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = null;
            Documento.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            UITestControl ReturnThis= new UITestControl();

            switch (SurfaceParameterControl)
            {
                case "RecalculateCBT":
                    {
                        HtmlButton Button = new HtmlButton(Documento);
                        Button.SearchProperties[HtmlButton.PropertyNames.Id] = "btnRecalcCBT";
                        Button.SearchProperties[HtmlButton.PropertyNames.Name] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.Type] = "button";
                        Button.FilterProperties[HtmlButton.PropertyNames.Title] = "Recalculate CBT";
                        Button.FilterProperties[HtmlButton.PropertyNames.Class] = null;
                        Button.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "style=\"WIDTH: 30px; HEIGHT: 30px\" id=btn";
                        Button.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "5";
                        Button.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

                        HtmlImage CBTImageBut = new HtmlImage(Button);
                        CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Id] = null;
                        CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Name] = null;
                        CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Alt] = null;
                        CBTImageBut.FilterProperties[HtmlImage.PropertyNames.Class] = null;
                        CBTImageBut.FilterProperties[HtmlImage.PropertyNames.TagInstance] = "1";
                        CBTImageBut.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
                        ReturnThis = CBTImageBut;
                        break;
                    }
                case "SaveChanges":
                    {
                        HtmlButton Button = new HtmlButton(Documento);
                        Button.SearchProperties[HtmlButton.PropertyNames.Id] = "btnSave";
                        Button.SearchProperties[HtmlButton.PropertyNames.Name] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.Type] = "button";
                        Button.FilterProperties[HtmlButton.PropertyNames.Title] = "Save changes";
                        Button.FilterProperties[HtmlButton.PropertyNames.Class] = null;
                        Button.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "style=\"WIDTH: 30px; HEIGHT: 30px\" id=btn";
                        Button.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "11";
                        Button.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

                        HtmlImage SaveImageBut = new HtmlImage(Button);
                        SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Id] = null;
                        SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Name] = null;
                        SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Alt] = null;
                        SaveImageBut.FilterProperties[HtmlImage.PropertyNames.Class] = null;
                        SaveImageBut.FilterProperties[HtmlImage.PropertyNames.TagInstance] = "1";
                        SaveImageBut.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
                        ReturnThis = SaveImageBut;
                        break;
                    }
                case "CBTTxt":
                    {
                        HtmlEdit CBTBox = new HtmlEdit(Documento);
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.Id] = "eCCBTRQ";
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.Name] = null;
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.LabeledBy] = null;
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.Type] = "SINGLELINE";
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.Title] = null;
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.Class] = "clsFloatEdit";
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "id=eCCBTRQ dataSrc=#eXml class=clsFloatE";
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "6";
                        CBTBox.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
                        ReturnThis = CBTBox;
                        break;
                    }
            }
            return ReturnThis;
        }
Example #38
0
        /// <summary>
        /// Gets the edit box on the screen based on the ID provided
        /// </summary>
        private HtmlEdit SelectEditBoxInCell(string editBoxName)
        {
            HtmlEdit editBoxWithinCell = new HtmlEdit(this.UIXeroSalesWindowsInteWindow.UIXeroNewRepeatingInvoDocument);
            editBoxWithinCell.SearchProperties.Add(HtmlEdit.PropertyNames.Id, editBoxName, PropertyExpressionOperator.Contains);

            return editBoxWithinCell;
        }
Example #39
0
 private void ClearForm(string id)
 {
     HtmlEdit edit = new HtmlEdit(BrowserManager.Instance.Browser);
     edit.SearchProperties.Add(HtmlEdit.PropertyNames.Id, id);
     edit.Text = "";
 }
Example #40
0
 public static void SetText(string text)
 {
     var editControl = new HtmlEdit(browserWindow);
     try
     {
         editControl.SearchProperties[CSVReader.ControlType + ".PropertyNames." + CSVReader.LocatorType] = CSVReader.LocatorValue;
         editControl.WaitForControlEnabled();
         editControl.WaitForControlReady();
     }
     catch (Exception)
     {
         Assert.Fail("Failed to find "+CSVReader.ControlType+" Element - Element not Found");
     }
     editControl.Text = text;
 }
Example #41
0
 public void TextBox(string prefix, string id, string value)
 {
     HtmlEdit TextBox = new HtmlEdit(Doc);
     TextBox.SearchProperties[HtmlEdit.PropertyNames.Id] = prefix + id;
     //string html = (((mshtml.HTMLBodyClass)(((Microsoft.VisualStudio.TestTools.UITesting.UITestControl)(Doc))
     //.NativeElement)).parentElement).innerHTML;
     TextBox.Text = value;
 }
Example #42
0
 public WebEdit(List<UIProperty> controlProps)
 {
     BrowserWindow window = this.GetBrowser(controlProps);
     webedit = new HtmlEdit(window);
     controlProps.ForEach(property => webedit.SearchProperties[property.PropertyName] = property.PropertyValue);
 }
Example #43
0
 public string GetTextBoxValue(string id)
 {
     HtmlEdit TextBox = new HtmlEdit(Doc);
     TextBox.SearchProperties[HtmlEdit.PropertyNames.Id] = id;
     return TextBox.Text;
 }
        public void AddData(string filename, string testcase)
        {
            DataTable dt1 = hlp.dtFromExcelFile(filename, "Template");
            DataTable dt2 = hlp.dtFromExcelFile(filename, "ExpectedData", "TestCase", testcase);
            UITestControl UIcurrentparent = null;
            for (int i = 0; i < dt1.Rows.Count; i++)
            {
                string controlValue = "";
                string parentType = dt1.Rows[i]["ParentType"].ToString();
                string parentSearchBy = dt1.Rows[i]["parentSearchBy"].ToString();
                string parentSearchValue = dt1.Rows[i]["parentSearchValue"].ToString();
                string pTechnology = dt1.Rows[i]["Technology"].ToString();
                string controlType = dt1.Rows[i]["ControlType"].ToString();
                string technologyControl = dt1.Rows[i]["TechnologyControl"].ToString();
                string field = dt1.Rows[i]["Field"].ToString();
                string index = dt1.Rows[i]["Index"].ToString();
                string searchBy = dt1.Rows[i]["SearchBy"].ToString();
                string searchValue = dt1.Rows[i]["SearchValue"].ToString();
                string pOperator = dt1.Rows[i]["pOperator"].ToString();
                string cOperator = dt1.Rows[i]["cOperator"].ToString();
                if (field.Length > 0)
                {
                    controlValue = dt2.Rows[0][field].ToString();
                }

                if (parentType.Length > 0)
                {
                    switch (parentType.ToLower())
                    {

                        #region Window
                        case "window":
                            {
                                if (pTechnology.ToLower() == "msaa")
                                {
                                    WinWindow uiwindow = new WinWindow();
                                    if (pOperator == "=")
                                    {
                                        uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue);
                                    }
                                    else if (pOperator == "~")
                                    {
                                        uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains);
                                    }
                                    UIcurrentparent = uiwindow;
                                }
                                else if (pTechnology == "uia")
                                {
                                    WpfWindow uiwindow = new WpfWindow();
                                    if (pOperator == "=")
                                    {
                                        uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue);
                                    }
                                    else if (pOperator == "~")
                                    {
                                        uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains);
                                    }
                                    UIcurrentparent = uiwindow;

                                }
                                break;
                            }
                        #endregion

                        #region client
                        case "client":
                            {
                                if (pTechnology.ToLower() == "msaa")
                                {
                                    WinClient uicleint = new WinClient(UIcurrentparent);
                                    if (pOperator == "=")
                                    {
                                        uicleint.SearchProperties.Add(parentSearchBy, parentSearchValue);
                                    }
                                    else if (pOperator == "~")
                                    {
                                        uicleint.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains);
                                    }
                                    UIcurrentparent = uicleint;
                                }
                                else if (pTechnology.ToLower() == "uia")
                                {
                                    // to do
                                }
                                break;
                            }
                        #endregion

                        #region docuemnt
                        case "document":
                            {
                                if (pTechnology.ToLower() == "web")
                                {
                                    HtmlDocument uidoc = new HtmlDocument(UIcurrentparent);
                                    if (pOperator == "=")
                                    {
                                        uidoc.SearchProperties.Add(parentSearchBy, parentSearchValue);
                                    }
                                    else if (pOperator == "~")
                                    {
                                        uidoc.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains);
                                    }
                                    UIcurrentparent = uidoc;
                                }
                                else if (pTechnology.ToLower() == "uia")
                                {

                                    // to do
                                }
                                break;
                            }

            #endregion

                    }
                }
                if (controlType.Length > 0)
                {
                    switch (controlType.ToLower())
                    {
                        #region edit
                        case "edit":
                            {
                                if (technologyControl == "MSAA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "UIA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "Web")
                                {
                                    HtmlEdit uiedit = new HtmlEdit(UIcurrentparent);
                                    if (cOperator == "=")
                                    {
                                        uiedit.SearchProperties.Add(searchBy, searchValue);
                                    }
                                    else if (cOperator == "~")
                                    {
                                        uiedit.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains);
                                    }

                                    if (controlValue.Length > 0)
                                    {

                                        uiedit.Text = controlValue;
                                    }
                                }

                                break;
                            }
                        #endregion
                        #region button
                        case "button":
                            {
                                if (technologyControl == "MSAA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "UIA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "Web")
                                {
                                    HtmlButton ucntl= new HtmlButton(UIcurrentparent);
                                    if (cOperator == "=")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue);
                                        if (index.Length > 0)
                                        {
                                            ucntl.SearchProperties.Add("TagInstance", index);
                                        }
                                    }
                                    else if (cOperator == "~")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains);
                                    }

                                    if (controlValue.Length > 0)
                                    {

                                        Mouse.Click(ucntl);
                                    }
                                }
                                break;
                            }
                        #endregion
                        #region image
                        case "image":
                            {
                                if (technologyControl == "MSAA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "UIA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "Web")
                                {
                                    HtmlImage ucntl = new HtmlImage(UIcurrentparent);
                                    if (cOperator == "=")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue);
                                        if (index.Length > 0)
                                        {
                                            ucntl.SearchProperties.Add("TagInstance", index);
                                        }
                                    }
                                    else if (cOperator == "~")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains);
                                    }

                                    if (controlValue.Length > 0)
                                    {

                                        Mouse.Click(ucntl);
                                    }
                                }
                                break;
                            }
                        #endregion
                        #region Dropdown
                        case "dropdown" :
                            {
                                if (technologyControl == "MSAA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "UIA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "Web")
                                {
                                    HtmlComboBox ucntl = new HtmlComboBox(UIcurrentparent);
                                    if (cOperator == "=" )
                                    {
                                        if (searchValue.Length > 0)
                                        {
                                            ucntl.SearchProperties.Add(searchBy, searchValue);
                                        }
                                        if (index.Length > 0)
                                        {
                                            ucntl.SearchProperties.Add("TagInstance", index);
                                        }
                                    }
                                    else if (cOperator == "~")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains);
                                    }

                                    if (controlValue.Length > 0)
                                    {

                                        ucntl.SelectedItem = controlValue;
                                        hlp.LogtoTextFile("Entered Value in ComboBox");
                                    }
                                }
                                break;
                            }
                        #endregion
                    }
                }

            }
        }