Esempio n. 1
0
        public void TestMethod_InvalidLogin()
        {
            readData();

            myManager.ActiveBrowser.NavigateTo(_Url);
            //CommonFunctions.Login(myManager, _username, _password, _Url);
            myManager.ActiveBrowser.Window.Maximize();

            ObjLogin objlogin = new ObjLogin(myManager);

            // Verify Invalid Login

            HtmlInputText     un = objlogin.txtusername.As <HtmlInputText>();
            HtmlInputPassword pw = objlogin.txtpassword.As <HtmlInputPassword>();

            un.Text = _invalidun;
            pw.Text = _invalidpw;

            Element logbtn = objlogin.btnlogin;

            myManager.ActiveBrowser.Actions.Click(logbtn);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();


            Element verifyError = objlogin.invalidloginMsg;

            Assert.IsTrue(verifyError.InnerText.Contains("The entered username & password combination is incorrect"));

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();
        }
Esempio n. 2
0
    private string ContructInputs(string first, string last, string id, string email)
    {
        HtmlInputText     inputFirst      = new HtmlInputText();
        HtmlInputText     inputLast       = new HtmlInputText();
        HtmlInputText     inputId         = new HtmlInputText();
        HtmlInputPassword inputPass       = new HtmlInputPassword();
        HtmlInputPassword inputRepeatPass = new HtmlInputPassword();
        HtmlInputText     inputEmail      = new HtmlInputText();

        inputFirst.ID      = "firstName";
        inputLast.ID       = "lastName";
        inputPass.ID       = "userPassword";
        inputRepeatPass.ID = "repeatPassword";
        inputId.ID         = "id";
        inputEmail.ID      = "email";

        inputFirst.Value = first;
        inputLast.Value  = last;
        inputId.Value    = id;
        inputEmail.Value = email;

        string br = "<br />";

        return
            (RenderControlToHtml(inputFirst) + br +
             RenderControlToHtml(inputLast) + br +
             RenderControlToHtml(inputId) + br +
             RenderControlToHtml(inputPass) + br +
             RenderControlToHtml(inputRepeatPass) + br +
             RenderControlToHtml(inputEmail));
    }
        /// <summary>
        /// Types password in the input text field.
        /// </summary>
        /// <param name="userName">the password.</param>
        public void EnterPassword(string password)
        {
            HtmlInputPassword passwordField = this.EM.Identity.LoginFormFrontend.Password.AssertIsPresent("password input");

            passwordField.Text = string.Empty;
            passwordField.Text = password;
        }
Esempio n. 4
0
        public void TestMethod_userLocked()
        {
            readData();

            ObjLogin objlogin = new ObjLogin(myManager);

            myManager.ActiveBrowser.NavigateTo("http://146.185.172.122/QA/#/login");
            myManager.ActiveBrowser.Window.Maximize();

            HtmlInputText     username = objlogin.un.As <HtmlInputText>();
            HtmlInputPassword password = objlogin.pw.As <HtmlInputPassword>();
            Element           login    = objlogin.btnlogin;

            username.Text = _usern;
            password.Text = _pwd;

            for (int a = 0; a < 3; a = a + 1)
            {
                myManager.ActiveBrowser.Actions.Click(login);
            }

            Thread.Sleep(1000);
            myManager.ActiveBrowser.RefreshDomTree();

            //Element verifylockedmsg = objlogin.userlockedMsg;
            //Assert.IsTrue(verifylockedmsg.InnerText.Contains("Your account has been locked.Please contact the Administrator."));

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            verifyLocked();

            Thread.Sleep(3000);
            myManager.ActiveBrowser.RefreshDomTree();
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HtmlInputText textInput =
                new HtmlInputText {
                ID = "name", Value = "Mark"
            };

            nameDiv.Controls.Add(textInput);

            HtmlInputPassword passInput =
                new HtmlInputPassword {
                ID = "pass", Value = "secret"
            };

            passDiv.Controls.Add(passInput);

            hiddenAndButtonDiv.InnerHtml
                = "<input id=\"button\" type=\"submit\" value=\"Submit\" />";
            HtmlInputHidden hiddenInput
                = new HtmlInputHidden {
                ID = "hiddenValue", Value = "true"
                };

            hiddenAndButtonDiv.Controls.Add(hiddenInput);
        }
Esempio n. 6
0
        public static Hashtable GetWebControls(Control page)
        {
            Hashtable ht   = new Hashtable(System.StringComparer.Create(System.Globalization.CultureInfo.CurrentCulture, true));//不区分大小写,便于模型绑定
            int       size = HttpContext.Current.Request.Params.Count;

            for (int i = 0; i < size; i++)
            {
                string  id      = HttpContext.Current.Request.Params.GetKey(i);
                Control control = page.FindControl(id);
                if (control == null)
                {
                    continue;
                }

                if (control is HtmlInputText)
                {
                    HtmlInputText txt = (HtmlInputText)control;
                    ht[txt.ID] = txt.Value.Trim();
                }
                if (control is TextBox) //新加服务端控件 还有其他控件
                {
                    TextBox txt = (TextBox)control;
                    ht[txt.ID] = txt.Text.Trim();
                }
                if (control is HtmlSelect)
                {
                    HtmlSelect txt = (HtmlSelect)control;
                    //for (int j = 0; j < txt.Items.Count; j++)
                    //{
                    //    if (txt.Items[j].Selected)
                    //    {
                    //        ht[txt.ID] =txt.Items[j].Text;
                    //    }
                    //}
                    ht[txt.ID] = txt.Value.Trim();
                }

                if (control is HtmlInputHidden)
                {
                    HtmlInputHidden txt = (HtmlInputHidden)control;
                    ht[txt.ID] = txt.Value.Trim();
                }
                if (control is HtmlInputPassword)
                {
                    HtmlInputPassword txt = (HtmlInputPassword)control;
                    ht[txt.ID] = txt.Value.Trim();
                }
                if (control is HtmlInputCheckBox)
                {
                    HtmlInputCheckBox chk = (HtmlInputCheckBox)control;
                    ht[chk.ID] = chk.Checked ? 1 : 0;
                }
                if (control is HtmlTextArea)
                {
                    HtmlTextArea area = (HtmlTextArea)control;
                    ht[area.ID] = area.Value.Trim();
                }
            }
            return(ht);
        }
Esempio n. 7
0
        public static Hashtable GetWebControls(Control page)
        {
            Hashtable ht   = new Hashtable();
            int       size = HttpContext.Current.Request.Params.Count;

            for (int i = 0; i < size; i++)
            {
                string  id      = HttpContext.Current.Request.Params.GetKey(i);
                Control control = page.FindControl(id);
                if (control != null)
                {
                    control = page.FindControl(id);
                    if (control is HtmlInputText)
                    {
                        HtmlInputText txt = (HtmlInputText)control;
                        ht[txt.ID] = txt.Value.Trim();
                    }
                    if (control is TextBox)
                    {
                        TextBox txt2 = (TextBox)control;
                        ht[txt2.ID] = txt2.Text.Trim();
                    }
                    if (control is HtmlSelect)
                    {
                        HtmlSelect txt3 = (HtmlSelect)control;
                        ht[txt3.ID] = txt3.Value.Trim();
                    }
                    if (control is HtmlInputHidden)
                    {
                        HtmlInputHidden txt4 = (HtmlInputHidden)control;
                        ht[txt4.ID] = txt4.Value.Trim();
                    }
                    if (control is HtmlInputPassword)
                    {
                        HtmlInputPassword txt5 = (HtmlInputPassword)control;
                        ht[txt5.ID] = txt5.Value.Trim();
                    }
                    if (control is HtmlInputCheckBox)
                    {
                        HtmlInputCheckBox chk = (HtmlInputCheckBox)control;
                        ht[chk.ID] = (chk.Checked ? 1 : 0);
                    }
                    if (control is HtmlTextArea)
                    {
                        HtmlTextArea area = (HtmlTextArea)control;
                        ht[area.ID] = area.Value.Trim();
                    }
                    if (control is HtmlInputRadioButton)
                    {
                        HtmlInputRadioButton radio = (HtmlInputRadioButton)control;
                        if (radio.Checked)
                        {
                            ht[radio.Name] = radio.Value.Trim();
                        }
                    }
                }
            }
            return(ht);
        }
Esempio n. 8
0
 public static void SetWebControls(Control page, Hashtable ht)
 {
     if (ht != null && ht.Count != 0)
     {
         int size = ht.Keys.Count;
         foreach (string key in ht.Keys)
         {
             object val = ht[key];
             if (val != null)
             {
                 Control control = page.FindControl(key);
                 if (control == null)
                 {
                     continue;
                 }
                 if (control is HtmlInputText)
                 {
                     HtmlInputText txt = (HtmlInputText)control;
                     txt.Value = val.ToString().Trim();
                 }
                 if (control is TextBox)//新加
                 {
                     TextBox txt = (TextBox)control;
                     txt.Text = val.ToString().Trim();
                 }
                 if (control is HtmlSelect)
                 {
                     HtmlSelect txt = (HtmlSelect)control;
                     txt.Value = val.ToString().Trim();
                 }
                 if (control is HtmlInputHidden)
                 {
                     HtmlInputHidden txt = (HtmlInputHidden)control;
                     txt.Value = val.ToString().Trim();
                 }
                 if (control is HtmlInputPassword)
                 {
                     HtmlInputPassword txt = (HtmlInputPassword)control;
                     txt.Value = val.ToString().Trim();
                 }
                 if (control is Label)
                 {
                     Label txt = (Label)control;
                     txt.Text = val.ToString().Trim();
                 }
                 if (control is HtmlInputCheckBox)
                 {
                     HtmlInputCheckBox chk = (HtmlInputCheckBox)control;
                     chk.Checked = val.ToInt() == 1 ? true : false;
                 }
                 if (control is HtmlTextArea)
                 {
                     HtmlTextArea area = (HtmlTextArea)control;
                     area.Value = val.ToString().Trim();
                 }
             }
         }
     }
 }
Esempio n. 9
0
        /// <summary>
        /// Fill user old password
        /// </summary>
        /// <param name="oldPassword">Old password</param>
        public void FillOldPassword(string oldPassword)
        {
            HtmlInputPassword oldPasswordInput = EM.Identity.ProfileFrontend.OldPassword
                                                 .AssertIsPresent("Last name field");

            oldPasswordInput.Text = string.Empty;
            oldPasswordInput.Text = oldPassword;
        }
Esempio n. 10
0
        /// <summary>
        /// Fill user new password
        /// </summary>
        /// <param name="newPassword">New password</param>
        public void FillNewPassword(string newPassword)
        {
            HtmlInputPassword newPasswordInput = EM.Identity.ProfileFrontend.NewPassword
                                                 .AssertIsPresent("Password field");

            newPasswordInput.Text = string.Empty;
            newPasswordInput.Text = newPassword;
        }
        /// <summary>
        /// Retype user password
        /// </summary>
        /// <param name="firstName">Retype Password</param>
        public void FillRetypePassword(string password)
        {
            HtmlInputPassword passwordInput = EM.Identity.RegistrationFrontend.ReTypePassword
                                              .AssertIsPresent("Re-type passord field");

            passwordInput.Text = string.Empty;
            passwordInput.Text = password;
        }
Esempio n. 12
0
 /// <summary>
 /// 创建哈希表给服务器控件赋值
 /// </summary>
 /// <param name="page"></param>
 /// <param name="ht"></param>
 public static void SetWebControls(Control page, Hashtable ht)
 {
     if (ht.Count != 0)
     {
         int size = ht.Keys.Count;
         foreach (string key in ht.Keys)
         {
             object  val     = ht[key];
             Control control = page.FindControl(key);
             if (control == null)
             {
                 continue;
             }
             if (control is HtmlInputText)
             {
                 HtmlInputText txt = (HtmlInputText)control;
                 txt.Value = val.ToString();
             }
             if (control is TextBox)
             {
                 TextBox txt = (TextBox)control;
                 txt.Text = val.ToString();
             }
             if (control is DropDownList)
             {
                 DropDownList txt = (DropDownList)control;
                 txt.SelectedValue = val.ToString();
             }
             if (control is HtmlSelect)
             {
                 HtmlSelect txt = (HtmlSelect)control;
                 txt.Value = val.ToString();
             }
             if (control is HtmlInputHidden)
             {
                 HtmlInputHidden txt = (HtmlInputHidden)control;
                 txt.Value = val.ToString();
             }
             if (control is HtmlInputPassword)
             {
                 HtmlInputPassword txt = (HtmlInputPassword)control;
                 txt.Value = val.ToString();
             }
             if (control is Label)
             {
                 Label txt = (Label)control;
                 txt.Text = val.ToString();
             }
             if (control is HtmlTextArea)
             {
                 HtmlTextArea area = (HtmlTextArea)control;
                 area.Value = val.ToString();
             }
         }
     }
 }
Esempio n. 13
0
 protected override void InitializeSkin(Control skin)
 {
     Input_OldPwd       = (HtmlInputPassword)skin.FindControl("Input_OldPwd");
     Input_NewPwd       = (HtmlInputPassword)skin.FindControl("Input_NewPwd");
     Input_NewSecondPwd = (HtmlInputPassword)skin.FindControl("Input_NewSecondPwd");
     btn_UpPwd          = (Button)skin.FindControl("btn_UpPwd");
     btn_UpPwd.Click   += btn_UpPwd_Click;
     btn_Back           = (Button)skin.FindControl("btn_Back");
     btn_Back.Click    += btn_Back_Click;
     hid_Count          = (HtmlInputHidden)skin.FindControl("hid_Count");
 }
Esempio n. 14
0
 private bool CheckText(HtmlInputPassword Input)
 {
     if (Input.Value == "")
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Esempio n. 15
0
        public void TestMethod_FirstTimeLogin()
        {
            myManager.ActiveBrowser.NavigateTo("http://146.185.172.122/QA/#/login");

            myManager.ActiveBrowser.Window.Maximize();

            ObjFirstTimeLogin firstTime = new ObjFirstTimeLogin(myManager);

            HtmlInputText     username = firstTime.usn.As <HtmlInputText>();
            HtmlInputPassword password = firstTime.pwd.As <HtmlInputPassword>();
            Element           login    = firstTime.signbtn;


            username.Text = "CasatUser7";
            password.Text = "CasatUser7";
            myManager.ActiveBrowser.Actions.Click(login);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();

            // --- First time Login screen ---

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            //Verify First time login screen
            Element verifyFisrttimescreen = firstTime.pageheadingtxt;

            Assert.IsTrue(verifyFisrttimescreen.InnerText.Contains("You are logging in for the first time. Please change your password first."));

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlInputPassword newpassword     = firstTime.newpw1.As <HtmlInputPassword>();
            HtmlInputPassword reenterpassword = firstTime.newpw2.As <HtmlInputPassword>();
            Element           changebtn       = firstTime.changebutton;

            newpassword.Text     = "1qaz@WSX";
            reenterpassword.Text = "1qaz@WSX";
            myManager.ActiveBrowser.Actions.Click(changebtn);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();


            ////Verify login
            //  Element verificationtext = myManager.ActiveBrowser.Find.ById("da");
            //  Assert.AreEqual(verificationtext.InnerText, "Commit Flow Changes");

            Thread.Sleep(3000);
            myManager.ActiveBrowser.RefreshDomTree();
        }
Esempio n. 16
0
        public void DefaultProperties()
        {
            HtmlInputPassword it = new HtmlInputPassword();

            Assert.AreEqual(defaultAttributesCount, it.Attributes.Count, "Attributes.Count");

            Assert.AreEqual("password", it.Type, "Type");
            Assert.AreEqual(String.Empty, it.Value, "Value");

            Assert.AreEqual("input", it.TagName, "TagName");
            Assert.AreEqual(defaultAttributesCount, it.Attributes.Count, "Attributes.Count-2");
        }
Esempio n. 17
0
        /// <summary>
        /// 获取aspx页面 服务器控件值,返回哈希表
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public static Hashtable GetWebControls(Control page)
        {
            Hashtable ht   = new Hashtable();
            int       size = HttpContext.Current.Request.Params.Count;

            for (int i = 0; i < size; i++)
            {
                string  id      = HttpContext.Current.Request.Params.GetKey(i);
                Control control = page.FindControl(id);
                if (control == null)
                {
                    continue;
                }
                control = page.FindControl(id);
                if (control is HtmlInputText)
                {
                    HtmlInputText txt = (HtmlInputText)control;
                    ht[txt.ID] = txt.Value.Trim();
                }
                if (control is TextBox)
                {
                    TextBox txt = (TextBox)control;
                    ht[txt.ID] = txt.Text.Trim();
                }
                if (control is HtmlSelect)
                {
                    HtmlSelect txt = (HtmlSelect)control;
                    ht[txt.ID] = txt.Value.Trim();
                }
                if (control is HtmlInputHidden)
                {
                    HtmlInputHidden txt = (HtmlInputHidden)control;
                    ht[txt.ID] = txt.Value.Trim();
                }
                if (control is HtmlInputPassword)
                {
                    HtmlInputPassword txt = (HtmlInputPassword)control;
                    ht[txt.ID] = txt.Value.Trim();
                }
                if (control is HtmlInputCheckBox)
                {
                    HtmlInputCheckBox chk = (HtmlInputCheckBox)control;
                    ht[chk.ID] = chk.Checked == true ? 1 : 0;
                }
                if (control is HtmlTextArea)
                {
                    HtmlTextArea area = (HtmlTextArea)control;
                    ht[area.ID] = area.Value.Trim();
                }
            }
            return(ht);
        }
        public void loginTodeactivateUser()
        {
            ObjMenus      menus         = new ObjMenus(myManager);
            ObjLogin      objlogin      = new ObjLogin(myManager);
            ObjUnlockUser objunlockuser = new ObjUnlockUser(myManager);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlListItem uslink = menus.user.As <HtmlListItem>();

            uslink.MouseHover();

            myManager.ActiveBrowser.RefreshDomTree();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlAnchor logout = menus.logoutlink.As <HtmlAnchor>();

            logout.MouseClick();

            Thread.Sleep(25000);
            myManager.ActiveBrowser.RefreshDomTree();

            Element verifylg = myManager.ActiveBrowser.Find.ByXPath("//*[@id='body']/div/div/div/div/div/div[2]/h3");

            Assert.IsTrue(verifylg.InnerText.Contains("Welcome to Casat"));

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlInputText     un  = objlogin.txtusername.As <HtmlInputText>();
            HtmlInputPassword pw  = objlogin.txtpassword.As <HtmlInputPassword>();
            Element           log = objlogin.btnlogin;

            un.Text = _username1;
            pw.Text = _password1;
            myManager.ActiveBrowser.Actions.Click(log);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            Element verifyresetpg = objunlockuser.inactiveloginmsg;

            Assert.IsTrue(verifyresetpg.InnerText.Contains("Your account has been locked."));

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();
        }
Esempio n. 19
0
        public void verifyLocked()
        {
            ObjMenus menus = new ObjMenus(myManager);

            HtmlListItem system = menus.systemlink.As <HtmlListItem>();

            system.MouseHover();

            myManager.ActiveBrowser.RefreshDomTree();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlAnchor users = menus.userslink.As <HtmlAnchor>();

            users.MouseClick();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            ObjLogin objlogin = new ObjLogin(myManager);

            HtmlInputText     usernm = objlogin.txtusername.As <HtmlInputText>();
            HtmlInputPassword pw     = objlogin.txtpassword.As <HtmlInputPassword>();
            Element           login  = objlogin.btnlogin;

            usernm.Text = "admin";
            pw.Text     = "admin";
            myManager.ActiveBrowser.Actions.Click(login);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlInputText usersearch = objlogin.usernamesearch.As <HtmlInputText>();

            usersearch.Text = _searchusername;

            myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, usersearch.GetRectangle());
            myManager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlTable usertbl = objlogin.usertable.As <HtmlTable>();

            Assert.AreEqual(usertbl.BodyRows[0].Cells[7].InnerText, _status);

            Thread.Sleep(2000);
        }
Esempio n. 20
0
 protected override void InitializeSkin(Control skin)
 {
     Lab_MemLoginID         = (Label)skin.FindControl("Lab_MemLoginID");
     Input_NewPayPwd        = (HtmlInputPassword)skin.FindControl("Input_NewPayPwd");
     Input_NewSecondPayPwd  = (HtmlInputPassword)skin.FindControl("Input_NewSecondPayPwd");
     LinkButton_Save        = (LinkButton)skin.FindControl("LinkButton_Save");
     LinkButton_Save.Click += LinkButton_Save_Click;
     Lab_MobileOrEmailValue = (Label)skin.FindControl("Lab_MobileOrEmailValue");
     Lab_MobileOrEmailText  = (Label)skin.FindControl("Lab_MobileOrEmailText");
     string_1            = Common.Common.ReqStr("key");
     Lab_MemLoginID.Text = base.MemLoginID;
     if (
         !(((Common.Common.ReqStr("Email") != null) || (Common.Common.ReqStr("Mobile") != null))
             ? !(string_1 != "")
             : true))
     {
         try
         {
             string_2 = (Common.Common.ReqStr("Email") == "") ? "Mobile" : "Email";
             string_3 = (Common.Common.ReqStr("Email") == "")
                 ? Common.Common.ReqStr("Mobile")
                 : Common.Common.ReqStr("Email");
             var action = (ShopNum1_MemberActivate_Action)LogicFactory.CreateShopNum1_MemberActivate_Action();
             if (!action.CheckKey(string_2, base.MemLoginID, string_1, string_3))
             {
                 if (string_2 == "Email")
                 {
                     Page.Response.Redirect("A_CheckEmail.aspx");
                 }
                 if (string_2 == "Mobile")
                 {
                     Page.Response.Redirect("A_CheckEmail.aspx");
                 }
                 else
                 {
                     Page.Response.Redirect("A_PwdSer.aspx");
                 }
             }
         }
         catch
         {
             Page.Response.Redirect("A_PwdSer.aspx");
         }
     }
     else
     {
         Page.Response.Redirect("A_PwdSer.aspx");
     }
 }
Esempio n. 21
0
        private void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            if (this.changePasswordButton != null)
            {
                this.changePasswordButton.Dispose();
                this.changePasswordButton = null;
            }

            if (this.confirmPasswordInputPassword != null)
            {
                this.confirmPasswordInputPassword.Dispose();
                this.confirmPasswordInputPassword = null;
            }

            if (this.errorMessage != null)
            {
                this.errorMessage.Dispose();
                this.errorMessage = null;
            }

            if (this.message != null)
            {
                this.message.Dispose();
                this.message = null;
            }

            if (this.newPasswordInputPassword != null)
            {
                this.newPasswordInputPassword.Dispose();
                this.newPasswordInputPassword = null;
            }

            if (this.passwordInputPassword != null)
            {
                this.passwordInputPassword.Dispose();
                this.passwordInputPassword = null;
            }
            this.disposed = true;
        }
Esempio n. 22
0
 protected override void InitializeSkin(Control skin)
 {
     txt_Decrease       = (HtmlInputText)skin.FindControl("txt_Decrease");
     txt_Bank           = (HtmlInputText)skin.FindControl("txt_Bank");
     txt_Remark         = (HtmlTextArea)skin.FindControl("txt_Remark");
     txt_RealName       = (HtmlInputText)skin.FindControl("txt_RealName");
     txt_ConfirmBankID  = (HtmlInputText)skin.FindControl("txt_ConfirmBankID");
     Lab_AdPayment      = (Label)skin.FindControl("Lab_AdPayment");
     Lab_MemLoginID     = (Label)skin.FindControl("Lab_MemLoginID");
     input_PayPwd       = (HtmlInputPassword)skin.FindControl("input_PayPwd");
     hid_BankType       = (HtmlInputHidden)skin.FindControl("hid_BankType");
     txt_Account        = (HtmlInputText)skin.FindControl("txt_Account");
     hid_RealName       = (HtmlInputHidden)skin.FindControl("hid_RealName");
     txt_hidbank        = (HtmlInputText)skin.FindControl("txt_hidbank");
     Btn_Confirm        = (Button)skin.FindControl("Btn_Confirm");
     Btn_Confirm.Click += Btn_Confirm_Click;
     Rep_PayDecrease    = (Repeater)skin.FindControl("Rep_PayDecrease");
     Rep_NoValue        = (Repeater)skin.FindControl("Rep_NoValue");
     hidMemberType      = (HtmlInputHidden)skin.FindControl("hidMemberType");
     hid_SelectBank     = (HiddenField)skin.FindControl("hid_SelectBank");
     txt_StartTime      = (HtmlInputText)skin.FindControl("txt_StartTime");
     txt_EndTime        = (HtmlInputText)skin.FindControl("txt_EndTime");
     txt_OrderNum       = (HtmlInputText)skin.FindControl("txt_OrderNum");
     Btn_Select         = (Button)skin.FindControl("Btn_Select");
     Btn_Select.Click  += Btn_Select_Click;
     lab_PayNum         = (Label)skin.FindControl("lab_PayNum");
     lab_PayDecrease    = (Label)skin.FindControl("lab_PayDecrease");
     pageDiv            = (HtmlGenericControl)skin.FindControl("pageDiv");
     pageid             = (Common.Common.ReqStr("PageID") == "") ? "1" : Common.Common.ReqStr("PageID");
     GetMemInfo();
     if (!Page.IsPostBack)
     {
         strStartTime        = (Common.Common.ReqStr("StartTime") == "") ? "" : Common.Common.ReqStr("StartTime");
         strEndTime          = (Common.Common.ReqStr("EndTime") == "") ? "" : Common.Common.ReqStr("EndTime");
         strOrderNum         = (Common.Common.ReqStr("OrderNum") == "") ? "" : Common.Common.ReqStr("OrderNum");
         txt_StartTime.Value = strStartTime;
         txt_EndTime.Value   = strEndTime;
         txt_OrderNum.Value  = strOrderNum;
         hidMemberType.Value = Common.Common.GetNameById("membertype", "shopnum1_member",
                                                         " And MemloginId='" + base.MemLoginID + "'");
         method_0();
     }
 }
Esempio n. 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var inputText = new HtmlInputText {
                ID = "name", Value = "Bob"
            };

            nameDiv.Controls.Add(inputText);

            var inputPassword = new HtmlInputPassword {
                ID = "pass", Value = "secret"
            };

            passDiv.Controls.Add(inputPassword);

            hiddenAndButtonDiv.InnerHtml = "<input id=\"button\" type=\"submit\" value=\"Submit\" />";
            var inputHidden = new HtmlInputHidden {
                ID = "hiddenValue", Value = "true"
            };

            hiddenAndButtonDiv.Controls.Add(inputHidden);
        }
Esempio n. 24
0
        private static void AddPasswordField(HtmlGenericControl container)
        {
            using (HtmlGenericControl field = new HtmlGenericControl("div"))
            {
                field.Attributes.Add("class", "field");

                using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.Password, "PasswordInputPassword"))
                {
                    field.Controls.Add(label);
                }

                using (HtmlInputPassword passwordInputPassword = new HtmlInputPassword())
                {
                    passwordInputPassword.ID = "PasswordInputPassword";
                    passwordInputPassword.Attributes.Add("placeholder", Titles.Password);
                    field.Controls.Add(passwordInputPassword);
                }

                container.Controls.Add(field);
            }
        }
Esempio n. 25
0
        public void TestMethod_firstLoginPWmismatch()
        {
            myManager.ActiveBrowser.NavigateTo("http://146.185.172.122/QA/#/login");

            myManager.ActiveBrowser.Window.Maximize();

            ObjFirstTimeLogin firstTime = new ObjFirstTimeLogin(myManager);

            HtmlInputText     username = firstTime.usn.As <HtmlInputText>();
            HtmlInputPassword password = firstTime.pwd.As <HtmlInputPassword>();
            Element           login    = firstTime.signbtn;

            username.Text = "CasatUser8";
            password.Text = "CasatUser8";
            myManager.ActiveBrowser.Actions.Click(login);

            Thread.Sleep(1000);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlInputPassword newpassword     = firstTime.newpw1.As <HtmlInputPassword>();
            HtmlInputPassword reenterpassword = firstTime.newpw2.As <HtmlInputPassword>();
            Element           changebtn       = firstTime.changebutton;

            newpassword.Text     = "1qaz@WSX";
            reenterpassword.Text = "1qaz@WS";
            myManager.ActiveBrowser.Actions.Click(changebtn);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            // Verify password mismatch message
            Element verificationmsg1 = firstTime.verifypwmismatchMsg;

            Assert.IsTrue(verificationmsg1.InnerText.Contains("The entered passwords do not match. Please try again."));

            Thread.Sleep(3000);
            myManager.ActiveBrowser.RefreshDomTree();
        }
        public static void Login(Manager m, string uname, string pw, string Url)
        {
            m.ActiveBrowser.NavigateTo(Url);

            m.ActiveBrowser.Window.Maximize();

            ObjLogin objlogin = new ObjLogin(m);

            // Define Vriables for the classes
            HtmlInputText     username = objlogin.txtusername.As <HtmlInputText>();
            HtmlInputPassword password = objlogin.txtpassword.As <HtmlInputPassword>();
            Element           login    = objlogin.btnlogin;

            // Assign values
            username.Text = uname;
            password.Text = pw;
            m.ActiveBrowser.Actions.Click(login);

            Thread.Sleep(1000);
            m.ActiveBrowser.WaitUntilReady();
            m.ActiveBrowser.RefreshDomTree();
        }
        public void SubmitAdTest()
        {
            Manager.LaunchNewBrowser();
            ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, TESTPAGE));

            // Find all the required elements on the page
            HtmlForm              form           = Find.ById <HtmlForm>("Form2");
            IList <HtmlSelect>    selectsList    = form.Find.AllByTagName <HtmlSelect>("select");
            IList <HtmlInputText> textInputsList = form.Find.AllByTagName <HtmlInputText>("input");
            HtmlInputPassword     passwordField  = form.Find.ById <HtmlInputPassword>("txtPassword");
            HtmlTextArea          description    = form.Find.ById <HtmlTextArea>("txtDescription");
            HtmlInputSubmit       submit         = form.Find.ById <HtmlInputSubmit>("submit");

            // Enter data into the input fields
            Actions.ScrollToVisible(submit.BaseElement, ScrollToVisibleType.ElementBottomAtWindowBottom);
            selectsList[(int)Selects.Year].SelectByText("1956");
            selectsList[(int)Selects.Make].SelectByText("Ford");
            textInputsList[(int)TextInputFields.Model].Text = "T-Bird";
            textInputsList[(int)TextInputFields.Price].Text = "175000";
            textInputsList[(int)TextInputFields.Phone].Text = "555-122-5544";
            textInputsList[(int)TextInputFields.Email].Text = "*****@*****.**";
            selectsList[(int)Selects.AllowEmail].SelectByText("Yes");
            description.Text = "Beautifully restored two tone red & white classic T-Bird. Just like factory mint condition. Actual mileage is 175,600.";
            textInputsList[(int)TextInputFields.FirstName].Text = "Willard";
            textInputsList[(int)TextInputFields.LastName].Text  = "Laird";
            textInputsList[(int)TextInputFields.Company].Text   = "Laird Auto Restoration";
            textInputsList[(int)TextInputFields.Address].Text   = "147 Industrial Dr.";
            textInputsList[(int)TextInputFields.City].Text      = "Sacramento";
            selectsList[(int)Selects.State].SelectByText("California");
            textInputsList[(int)TextInputFields.Zip].Text      = "22746";
            textInputsList[(int)TextInputFields.UserName].Text = "wlaird335";
            passwordField.Text = "lairdinc";

            // Submit the ad
            submit.Click();
        }
Esempio n. 28
0
 public static void SetWebControls(Control page, Hashtable ht)
 {
     if (ht.Count != 0)
     {
         int size = ht.Keys.Count;
         foreach (string key in ht.Keys)
         {
             object  val     = ht[key];
             Control control = page.FindControl(key);
             if (control != null)
             {
                 if (control is HtmlInputText)
                 {
                     HtmlInputText txt = (HtmlInputText)control;
                     txt.Value = val.ToString();
                 }
                 if (control is TextBox)
                 {
                     TextBox txt2 = (TextBox)control;
                     txt2.Text = val.ToString();
                 }
                 if (control is DropDownList)
                 {
                     DropDownList txt3 = (DropDownList)control;
                     txt3.SelectedValue = val.ToString();
                 }
                 if (control is HtmlSelect)
                 {
                     HtmlSelect txt4 = (HtmlSelect)control;
                     txt4.Value = val.ToString();
                 }
                 if (control is HtmlInputHidden)
                 {
                     HtmlInputHidden txt5 = (HtmlInputHidden)control;
                     txt5.Value = val.ToString();
                 }
                 if (control is HtmlInputPassword)
                 {
                     HtmlInputPassword txt6 = (HtmlInputPassword)control;
                     txt6.Value = val.ToString();
                 }
                 if (control is Label)
                 {
                     Label txt7 = (Label)control;
                     txt7.Text = val.ToString();
                 }
                 if (control is HtmlTextArea)
                 {
                     HtmlTextArea area = (HtmlTextArea)control;
                     area.Value = val.ToString();
                 }
                 if (control is HtmlInputRadioButton)
                 {
                     HtmlInputRadioButton radio = (HtmlInputRadioButton)control;
                     radio.Value   = val.ToString();
                     radio.Checked = true;
                 }
             }
         }
     }
 }
        /// <summary>
        /// 设置页面控件的值
        /// </summary>
        /// <param name="page"></param>
        /// <param name="ht"></param>
        public static void SetWebControls(Control page, Hashtable ht)
        {
            if (ht.Count != 0)
            {
                int size = ht.Keys.Count;
                foreach (string key in ht.Keys)
                {
                    object val = ht[key];
                    if (val != null)
                    {
                        Control control   = page.FindControl("txt" + key);
                        Control hiddenCtr = page.FindControl("h" + key);
                        //var s = control.NamingContainer;

                        #region hidden input

                        if (hiddenCtr != null)
                        {
                            HtmlInputHidden hInput = (HtmlInputHidden)hiddenCtr;
                            if (hInput != null)
                            {
                                hInput.Value = val.ToString().Trim();
                            }
                        }

                        #endregion hidden input

                        #region normal control

                        if (control == null)
                        {
                            continue;
                        }
                        if (control is HtmlGenericControl)
                        {
                            HtmlGenericControl txt = (HtmlGenericControl)control;
                            txt.InnerHtml = val.ToString().Trim();
                        }
                        if (control is HtmlInputText)
                        {
                            HtmlInputText txt = (HtmlInputText)control;
                            txt.Value = val.ToString().Trim();
                        }
                        if (control is TextBox)
                        {
                            TextBox txt = (TextBox)control;
                            txt.Text = val.ToString().Trim();
                        }
                        if (control is HtmlSelect)
                        {
                            HtmlSelect txt = (HtmlSelect)control;

                            if (val.ToString().Trim().ToUpper() == "TRUE" ||
                                val.ToString().Trim().ToUpper() == "FALSE")
                            {
                                txt.Value = ((val.ToString().Trim().ToUpper() == "TRUE") ? "1" : "0");
                            }
                            else
                            {
                                txt.Value = val.ToString().Trim();
                            }
                        }
                        if (control is HtmlInputHidden)
                        {
                            HtmlInputHidden txt = (HtmlInputHidden)control;
                            txt.Value = val.ToString().Trim();
                        }
                        if (control is HtmlInputPassword)
                        {
                            HtmlInputPassword txt = (HtmlInputPassword)control;
                            txt.Value = val.ToString().Trim();
                        }
                        if (control is Label)
                        {
                            Label txt = (Label)control;
                            txt.Text = val.ToString().Trim();
                        }
                        if (control is HtmlInputCheckBox)
                        {
                            HtmlInputCheckBox chk = (HtmlInputCheckBox)control;
                            chk.Checked = val.ToSafeInt32(0) == 1 ? true : false;
                        }
                        if (control is HtmlTextArea)
                        {
                            HtmlTextArea area = (HtmlTextArea)control;
                            area.Value = val.ToString().Trim();
                        }
                        if (control is DropDownList)
                        {
                            DropDownList drp = (DropDownList)control;
                            drp.SelectedValue = val.ToString().Trim();
                        }

                        #endregion normal control
                    }
                }
            }
        }
Esempio n. 30
0
        public void TestSignin(User admin)
        {
            // Precondition
            // Test Steps
            LoginPage loginPage = Pages.Application.Get().Login();
            UsersPage usersPage = loginPage.SuccessAdminLogin(admin);

            //UsersPage usersPage = Application.Get().Login().SuccessAdminLogin(admin);
            //
            // Check
            Assert.AreEqual("LV-204 ISTQB", usersPage.GetUsernameText());
            //
            // Return to previous state
            loginPage = usersPage.GotoLogOut();
            //
            // Check
            Assert.AreEqual("SoftServe Language School", loginPage.GetLoginDescriptionText());



            //--------------------------------------------------------------

            //[Test]
            Manager  manager;
            Settings mySettings = new Settings();

            //
            // Precondition
            mySettings.Web.DefaultBrowser = BrowserType.Chrome;
            manager = new Manager(mySettings);
            manager.Start();
            manager.LaunchNewBrowser();
            manager.ActiveBrowser.NavigateTo("https://wow.training.local/Index#/Home");
            //
            IList <HtmlControl> description = manager.ActiveBrowser.Find.AllByXPath <HtmlControl>("//div[@class='text-primary']/h2/small");

            Console.WriteLine("description = " + description.Count);
            if ((description.Count == 0) && (manager.ActiveBrowser.BrowserType == BrowserType.Chrome))
            {
                for (int i = 0; i < 5; i++)
                {
                    manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Tab);
                }
                manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Space);
                manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Tab);
                manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Tab);
                manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter);
            }
            Thread.Sleep(1000);
            HtmlButton loginButton = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("class=btn btn-success");

            loginButton.Click();
            HtmlInputEmail loginInput = manager.ActiveBrowser.Find.ByAttributes <HtmlInputEmail>("ng-model=email");

            loginInput.Text = "*****@*****.**";
            Thread.Sleep(1000);
            HtmlInputPassword passwordInput = manager.ActiveBrowser.Find.ByAttributes <HtmlInputPassword>("ng-model=password");

            passwordInput.Text = "q2w3e4r5";
            Thread.Sleep(1000);
            HtmlInputSubmit submitInput = manager.ActiveBrowser.Find.ByName <HtmlInputSubmit>("loginButton");

            submitInput.Click();
            Thread.Sleep(2000);
            // Check
            HtmlSpan userAccount = manager.ActiveBrowser.Find.ByAttributes <HtmlSpan>("ng-bind=userName");

            Assert.AreEqual("Mariana Medynska", userAccount.TextContent);

            //Steps---------------------------------------------------------------------------------------------

            HtmlSpan managerButton = manager.ActiveBrowser.Find.ByContent <HtmlSpan>("p:Manager");

            managerButton.Click();
            //# cursorStyle > span:nth-child(2)
            // //*[@id="cursorStyle"]/span[1]

            HtmlSpan groupsButton = manager.ActiveBrowser.Find.ByContent <HtmlSpan>("l:Groups");

            managerButton.Click();
            //  //*[@id="teaching-tools"]/li/ul/li[4]/a/span
            //#teaching-tools > li > ul > li:nth-child(4) > a > span

            var myGroupsText = manager.ActiveBrowser.Find.ByXPath("//h2['My Groups']");

            Assert.AreEqual("My Groups", myGroupsText.TextContent);
            // #myJum > div > div.container.ng-scope > div:nth-child(1) > div > h2
            // //*[@id="myJum"]/div/div[3]/div[1]/div/h2
            // //h2["My Groups"]

            HtmlButton editPencilButton = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("//*[@id='myJum']/div/div[3]/div[4]/table/tbody/tr[2]/td[3]/a");

            editPencilButton.Click();
            //#myJum > div > div.container.ng-scope > div.panel.panel-default > table > tbody > tr:nth-child(2) > td:nth-child(3) > a
            // //*[@id="myJum"]/div/div[3]/div[4]/table/tbody/tr[2]/td[3]/a

            //Check if Test_M
            //var testMGroup = manager.ActiveBrowser.Find.ByAttributes<HtmlDiv>("class=col-md-4 text-left blod-text ng-binding");
            //testMGroup.Get
            //class = col-md-4 text-left blod-text ng-binding
            //# myJum > div > div.container.ng-scope > div:nth-child(2) > h3.col-md-4.text-left.blod-text.ng-binding
            // //*[@id="myJum"]/div/div[3]/div[2]/h3[1]

            HtmlButton selectDropdown = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("class=dropdown-toggle ng-binding btn btn-default");

            selectDropdown.Click();

            HtmlControl selectDropDownDialog = manager.ActiveBrowser.Find.ByAttributes <HtmlControl>("class=dropdown-menu dropdown-menu-form");
            //selectDropDownDialog.           - check names in the lists at least five

            HtmlAnchor checkAll = manager.ActiveBrowser.Find.ByContent <HtmlAnchor>("p:Check All");

            checkAll.Click();                 // how to check if names are checked/unchecked

            HtmlAnchor UnCheckAll = manager.ActiveBrowser.Find.ByAttributes <HtmlAnchor>("class=glyphicon glyphicon-remove");

            UnCheckAll.Click();

            HtmlInputSearch studentSearchByName = manager.ActiveBrowser.Find.ByAttributes <HtmlInputSearch>("class=form-control ng-pristine ng-valid ng-touched");

            HtmlButton submitChangesButton = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("class=btn btn-default center- block");


            manager.Dispose();
            Console.WriteLine("done");
        }