示例#1
0
 public static void SelectCheckbox(bool check)
 {
     var checkboxControl = new HtmlCheckBox(browserWindow);
     try
     {
         checkboxControl.SearchProperties[CSVReader.ControlType + ".PropertyNames." + CSVReader.LocatorType] = CSVReader.LocatorValue;
         checkboxControl.WaitForControlEnabled();
         checkboxControl.WaitForControlReady();
     }
     catch (Exception)
     {
         Assert.Fail("Failed to find " + CSVReader.ControlType + " Element - Element not Found");
     }
     checkboxControl.Checked = check;
 }
示例#2
0
        public EnhancedHtmlCheckBox GetEmbeddedCheckBox(int iRow, int iCol)
        {
            string sSearchProperties = "";

            mshtml.IHTMLElement td    = (mshtml.IHTMLElement)GetCell(iRow, iCol).UnWrap().NativeElement;
            mshtml.IHTMLElement check = GetEmbeddedCheckBoxNativeElement(td);
            string sOuterHTML         = check.outerHTML.Replace("<", "").Replace(">", "").Trim();

            string[]     saTemp = sOuterHTML.Split(' ');
            HtmlCheckBox chk    = new HtmlCheckBox(this.Control.Container);

            foreach (string sTemp in saTemp)
            {
                if (sTemp.IndexOf('=') > 0)
                {
                    string[] saKeyValue = sTemp.Split('=');
                    string   sValue     = saKeyValue[1];
                    if (saKeyValue[0].ToLower() == "name")
                    {
                        sSearchProperties += ";Name=" + sValue;
                        chk.SearchProperties.Add(HtmlControl.PropertyNames.Name, sValue);
                    }
                    if (saKeyValue[0].ToLower() == "id")
                    {
                        sSearchProperties += ";Id=" + sValue;
                        chk.SearchProperties.Add(HtmlControl.PropertyNames.Id, sValue);
                    }
                    if (saKeyValue[0].ToLower() == "class")
                    {
                        sSearchProperties += ";Class=" + sValue;
                        chk.SearchProperties.Add(HtmlControl.PropertyNames.Class, sValue);
                    }
                }
            }

            if (sSearchProperties.Length > 1)
            {
                sSearchProperties = sSearchProperties.Substring(1);
            }
            EnhancedHtmlCheckBox retChk = new EnhancedHtmlCheckBox(sSearchProperties);

            retChk.Wrap(chk);
            return(retChk);
        }
        /// <summary>
        /// executeautomationdemosite - Use 'executeautomationdemositeParams' to pass parameters into this method.
        /// </summary>
        public void executeautomationdemosite()
        {
            BrowserWindow.Launch(@"http://executeautomation.com/demosite/Login.html");

            #region Variable Declarations
            HtmlEdit        uIUserNameEdit    = this.UIExecuteAutomationIntWindow.UIExecuteAutomationDocument.UIUserNameEdit;
            HtmlEdit        uIPasswordEdit    = this.UIExecuteAutomationIntWindow.UIExecuteAutomationDocument.UIPasswordEdit;
            HtmlInputButton uILoginButton     = this.UIExecuteAutomationIntWindow.UIExecuteAutomationDocument.UILoginButton;
            HtmlComboBox    uITitleIdComboBox = this.UIExecuteAutomationIntWindow.UIExecuteAutomationDocument1.UITitleIdComboBox;
            HtmlEdit        uIInitialEdit     = this.UIExecuteAutomationIntWindow.UIExecuteAutomationDocument1.UIInitialEdit;
            HtmlEdit        uIFirstNameEdit   = this.UIExecuteAutomationIntWindow.UIExecuteAutomationDocument1.UIFirstNameEdit;
            HtmlCheckBox    uIHindiCheckBox   = this.UIExecuteAutomationIntWindow.UIExecuteAutomationDocument1.UIHindiCheckBox;
            HtmlInputButton uISaveButton      = this.UIExecuteAutomationIntWindow.UIExecuteAutomationDocument1.UISaveButton;
            #endregion

            // Type 'pradeep' in 'UserName' text box
            uIUserNameEdit.Text = this.executeautomationdemositeParams.UIUserNameEditText;

            // Type 'pradeep' in 'Password' text box
            uIPasswordEdit.Text = this.executeautomationdemositeParams.UIPasswordEditText;

            // Click 'Login' button
            Mouse.Click(uILoginButton, new Point(28, 11));

            // Select 'Mr.' in 'TitleId' combo box
            uITitleIdComboBox.SelectedItem = this.executeautomationdemositeParams.UITitleIdComboBoxSelectedItem;

            // Type 'KR' in 'Initial' text box
            uIInitialEdit.Text = this.executeautomationdemositeParams.UIInitialEditText;

            // Type 'kumar' in 'FirstName' text box
            uIFirstNameEdit.Text = this.executeautomationdemositeParams.UIFirstNameEditText;

            // Select 'Hindi' check box
            uIHindiCheckBox.Checked = this.executeautomationdemositeParams.UIHindiCheckBoxChecked;

            // Click 'Save' button
            Mouse.Click(uISaveButton, new Point(25, 11));
        }
示例#4
0
        public static void welcome_SaveNContinue()
        {
            //Create BrowserWindow
            BrowserWindow Browind = new BrowserWindow();

            //Welcome Pane
            HtmlControl welPane = new HtmlControl(Browind);

            welPane.FilterProperties[HtmlDiv.PropertyNames.InnerText] = "Welcome";

            //check checkbox
            HtmlCheckBox chkBox = new HtmlCheckBox(Browind);

            chkBox.SearchProperties[HtmlCheckBox.PropertyNames.Id] = "privacy_ack";

            {
            }
            //Save And Continue button
            HtmlControl SaveCont = new HtmlControl(Browind);

            SaveCont.SearchProperties[HtmlButton.PropertyNames.Id] = "ForwardButton_button";


            if (chkBox.Checked == false)
            {
                //Verify SaveNContinue button is unable
                Assert.IsFalse(SaveCont.Enabled);
                chkBox.SetProperty(HtmlCheckBox.PropertyNames.Checked, true);
            }
            else
            {
                Assert.IsTrue(SaveCont.Enabled);
                Mouse.Click(SaveCont);
            }

            Browind.WaitForControlReady(50000);
        }
示例#5
0
        private HtmlLabel CreateCheckBox(FormCheckBox formCheckBox)
        {
            HtmlLabel htmlLabel = new HtmlLabel();

            htmlLabel.Class.AddRange(new string[] { "switch", "switch-default", "switch-pill", "switch-primary", "ml-2" });

            HtmlCheckBox htmlCheckBox = new HtmlCheckBox(formCheckBox.Path);

            htmlCheckBox.Class.Add("switch-input");
            htmlCheckBox.Disabled.Value = formCheckBox.IsDisabled;
            htmlCheckBox.Checked.Value  = formCheckBox.Value;
            htmlLabel.Add(htmlCheckBox);

            HtmlSpan htmlSpan = new HtmlSpan();

            htmlSpan.Class.Add("switch-label");
            htmlLabel.Add(htmlSpan);

            htmlSpan = new HtmlSpan();
            htmlSpan.Class.Add("switch-handle");
            htmlLabel.Add(htmlSpan);

            return(htmlLabel);
        }
示例#6
0
 public WebCheckBox(List<UIProperty> controlProps)
 {
     BrowserWindow window = this.GetBrowser(controlProps);
     checkbox = new HtmlCheckBox(window);
     controlProps.ForEach(property => checkbox.SearchProperties[property.PropertyName] = property.PropertyValue);
 }
示例#7
0
        public static void Ereg_Release4Reference()
        {
            //Create BrowserWindow

            BrowserWindow browind = new BrowserWindow();

            //Agreement Pane
            browind.WaitForControlReady(20000);
            browind.SearchProperties[UITestControl.PropertyNames.Name] = "Release for Reference Checks and Verification of Information";

            //check checkbox
            HtmlCheckBox chkBox = new HtmlCheckBox(browind);

            chkBox.SearchProperties[HtmlCheckBox.PropertyNames.Id] = "ack3_agree";
            chkBox.DrawHighlight();


            //Button Save And Continue
            HtmlControl SaveCont = new HtmlControl(browind);

            SaveCont.SearchProperties[HtmlButton.PropertyNames.Id] = "ForwardButton_button";
            SaveCont.DrawHighlight();

            //chkBox.DrawHighlight();
            if (chkBox.Checked == false)
            {
                //Verify SaveNContinue button is unable
                Assert.IsFalse(SaveCont.Enabled);
                chkBox.SetProperty(HtmlCheckBox.PropertyNames.Checked, true);
            }
            else
            {
                Assert.IsTrue(SaveCont.Enabled);
            }


            // Progress Meter

            HtmlCustom progress = new HtmlCustom(browind);

            progress.SearchProperties[HtmlCustom.PropertyNames.Id] = "progressmeter";
            bool   availabilty   = (bool)progress.GetProperty(HtmlCustom.PropertyNames.Exists);
            string workflowEvent = PersonalInformation1.ReadData(1, "WORKFLOW");

            if (workflowEvent == "S1PROSPECT")
            {
                Assert.IsTrue(availabilty, "Progress Meter is not showing");

                HtmlSpan bar = new HtmlSpan(browind);
                bar.SearchProperties[HtmlSpan.PropertyNames.Id] = "meterlabel";
                string percentage = (string)bar.GetProperty(HtmlSpan.PropertyNames.InnerText);
                Assert.AreEqual(percentage, "95%");
            }
            else
            {
                Assert.IsFalse(availabilty, "Progress Meter is showing");
            }

            //Click Save And Continue

            Mouse.Click(SaveCont);
            browind.WaitForControlReady(2000);
        }
示例#8
0
        public static void paycheck_Stub()
        {
            //Create BrowserWindow
            BrowserWindow browind = new BrowserWindow();

            browind.SearchProperties[UITestControl.PropertyNames.Name] = "Personal Information";

            /********************/
            /*Period of Resident*/
            /********************/
            HtmlEdit since = new HtmlEdit(browind);

            since.SearchProperties[HtmlEdit.PropertyNames.Id] = "current_from";
            //Get data from eReg
            string eRegSinceDate = (string)since.GetProperty(HtmlEdit.PropertyNames.Text);

            /******************************/
            /* Button "Save And Continue" */
            /******************************/
            HtmlInputButton btnSaveNCont = new HtmlInputButton(browind);

            btnSaveNCont.SearchProperties[HtmlInputButton.PropertyNames.Id] = "ForwardButton_button";

            //Verify if button Save and Continue is disable if mandatory field is empty
            if (eRegSinceDate == "")
            {
                Assert.IsFalse(btnSaveNCont.Enabled);
            }


            if (eRegSinceDate == "")
            {
                //Get data from KSN/Excel
                string KSNSinceDate = PersonalInformation1.ReadData(1, "RESIDENTPERIOD");
                if (KSNSinceDate == "")
                {
                    since.SetProperty(HtmlEdit.PropertyNames.Text, "01/1990");
                }
                else
                {
                    since.SetProperty(HtmlEdit.PropertyNames.Text, PersonalInformation1.ReadData(1, "RESIDENTPERIOD"));
                }
            }

            Mouse.MoveScrollWheel(-100);


            /***********************/
            /*Paycheck/Stub Address*/
            /***********************/

            //Checkbox
            HtmlCheckBox chk = new HtmlCheckBox(browind);

            chk.SearchProperties[HtmlCheckBox.PropertyNames.Id] = "paycheck_current";
            if (chk.Checked == false)
            {
                chk.SetProperty(HtmlCheckBox.PropertyNames.Checked, true);
            }

            //Verify if the address is disable
            //Address
            HtmlEdit add = new HtmlEdit(browind);

            add.SearchProperties[HtmlEdit.PropertyNames.Id] = "Address_pay_clone";
            Assert.IsFalse(add.Enabled);

            HtmlEdit apt = new HtmlEdit(browind);

            apt.SearchProperties[HtmlEdit.PropertyNames.Id] = "AptSuite_pay_clone";
            Assert.IsFalse(apt.Enabled);

            HtmlEdit ct = new HtmlEdit(browind);

            ct.SearchProperties[HtmlEdit.PropertyNames.Id] = "city_pay_clone";
            Assert.IsFalse(ct.Enabled);

            HtmlComboBox st = new HtmlComboBox(browind);

            st.SearchProperties[HtmlComboBox.PropertyNames.Id] = "state_pay_clone";
            Assert.IsFalse(st.Enabled);

            HtmlEdit postal = new HtmlEdit(browind);

            postal.SearchProperties[HtmlEdit.PropertyNames.Id] = "zip_pay_clone";
            Assert.IsFalse(postal.Enabled);

            HtmlEdit z4 = new HtmlEdit(browind);

            z4.SearchProperties[HtmlEdit.PropertyNames.Id] = "zip_four_pay_clone";
            Assert.IsFalse(z4.Enabled);

            HtmlEdit county = new HtmlEdit(browind);

            county.SearchProperties[HtmlEdit.PropertyNames.Id] = "county_pay_clone";
            Assert.IsFalse(county.Enabled);

            HtmlComboBox country = new HtmlComboBox(browind);

            country.SearchProperties[HtmlComboBox.PropertyNames.Id] = "country_pay_clone";
            Assert.IsFalse(country.Enabled);

            HtmlEdit from = new HtmlEdit(browind);

            from.SearchProperties[HtmlEdit.PropertyNames.Id] = "pay_from_clone";
            Assert.IsFalse(from.Enabled);

            HtmlEdit to = new HtmlEdit(browind);

            to.SearchProperties[HtmlEdit.PropertyNames.Id] = "pay_to_clone";
            Assert.IsFalse(to.Enabled);

            /****************/
            /*Progress Meter*/
            /****************/

            HtmlCustom progress = new HtmlCustom(browind);

            progress.SearchProperties[HtmlCustom.PropertyNames.Id] = "progressmeter";
            bool   availabilty   = (bool)progress.GetProperty(HtmlCustom.PropertyNames.Exists);
            string workflowEvent = PersonalInformation1.ReadData(1, "WORKFLOW");

            if (workflowEvent == "S1PROSPECT")
            {
                Assert.IsTrue(availabilty, "Progress Meter is not showing");

                HtmlSpan bar = new HtmlSpan(browind);
                bar.SearchProperties[HtmlSpan.PropertyNames.Id] = "meterlabel";
                string percentage = (string)bar.GetProperty(HtmlSpan.PropertyNames.InnerText);
                Assert.AreEqual(percentage, "15%");
            }
            else
            {
                Assert.IsFalse(availabilty, "Progress Meter is showing");
            }

            Assert.IsTrue(btnSaveNCont.Enabled);
            Mouse.Click(btnSaveNCont);

            browind.WaitForControlReady(2000);
        }
示例#9
0
        public virtual void Visit(FormCheckBox formCheckBox, HtmlContainer htmlContainer)
        {
            HtmlDiv htmlDiv = verbose ? new HtmlDiv(formCheckBox.Path) : new HtmlDiv();

            htmlDiv.Class.Add("formCheckBox");

            if (!string.IsNullOrWhiteSpace(formCheckBox.CssClass))
            {
                htmlDiv.Class.AddRange(formCheckBox.CssClass.Split(' ').Where(s => s != string.Empty));
            }

            if (!string.IsNullOrWhiteSpace(formCheckBox.Path))
            {
                htmlDiv.Class.Add(string.Format("{0}{1}", "formId", formCheckBox.Path));
            }

            htmlDiv.Class.Add("formField");

            if (initialize)
            {
                htmlDiv.Class.Add(formCheckBox.IsRequired ? "formRequired" : "formOptional");
            }
            else
            {
                if (!formCheckBox.IsRequired || formCheckBox.Value)
                {
                    htmlDiv.Class.Add("formValid");
                }
                else
                {
                    htmlDiv.Class.Add(formCheckBox.IsRequired ? "formNotEntered" : "formOptional");
                }
            }

            htmlDiv.Hidden.Value = formCheckBox.IsHidden;

            htmlContainer.Add(htmlDiv);

            HtmlCheckBox htmlCheckBox = new HtmlCheckBox(formCheckBox.Path);

            htmlCheckBox.Disabled.Value = formCheckBox.IsDisabled;
            htmlCheckBox.Checked.Value  = formCheckBox.Value;

            if (!initialize && firstInvalidId == null)
            {
                if (formCheckBox.IsRequired && !formCheckBox.HasValue || !formCheckBox.IsValid)
                {
                    firstInvalidId = htmlCheckBox.Id.Value;
                }
            }

            switch (formCheckBox.OrderElements)
            {
            case OrderElements.LabelMarkInput:

                AddLabelMark(formCheckBox, htmlCheckBox, htmlDiv);
                htmlDiv.Add(htmlCheckBox);

                break;

            case OrderElements.MarkLabelInput:

                AddMarkLabel(formCheckBox, htmlCheckBox, htmlDiv);
                htmlDiv.Add(htmlCheckBox);

                break;

            case OrderElements.InputLabelMark:

                htmlDiv.Add(htmlCheckBox);
                AddLabelMark(formCheckBox, htmlCheckBox, htmlDiv);

                break;

            case OrderElements.InputMarkLabel:

                htmlDiv.Add(htmlCheckBox);
                AddMarkLabel(formCheckBox, htmlCheckBox, htmlDiv);

                break;

            case OrderElements.LabelInputMark:

                AddLabel(formCheckBox, htmlCheckBox, htmlDiv);
                htmlDiv.Add(htmlCheckBox);
                AddMark(formCheckBox, htmlCheckBox, htmlDiv);

                break;

            case OrderElements.MarkInputLabel:

                AddMark(formCheckBox, htmlCheckBox, htmlDiv);
                htmlDiv.Add(htmlCheckBox);
                AddLabel(formCheckBox, htmlCheckBox, htmlDiv);

                break;

            default:
            case OrderElements.NotSet:

                break;
            }

            if (initialize)
            {
                return;
            }

            string message = null;

            if (formCheckBox.UseLastMessage)
            {
                if (!string.IsNullOrEmpty(formCheckBox.LastMessage))
                {
                    message = formCheckBox.LastMessage;
                }
            }
            else if (formCheckBox.IsRequired && !formCheckBox.Value)
            {
                message = formCheckBox.RequiredMessage;
            }
            else if (!formCheckBox.IsValid)
            {
                message = formCheckBox.ValidationMessage;
            }

            if (message == null)
            {
                return;
            }

            HtmlLabel htmlLabelMessage = new HtmlLabel(verbose ? string.Format("{0}{1}", formCheckBox.Path, "Message") : "");

            htmlLabelMessage.Class.Add("formValidationMessage");
            htmlLabelMessage.For.Value = htmlCheckBox.Id.Value;
            htmlLabelMessage.Add(new HtmlText(formCheckBox.RequiredMessage));
            htmlDiv.Add(htmlLabelMessage);
        }
        public static void eReg_EncryptionConsent()
        {
            //*****************/
            //Create browserwindow
            /*****************/
            BrowserWindow browind = new BrowserWindow();

            browind.SearchProperties[UITestControl.PropertyNames.Name] = "Encryption Consent";

            //Verify References pane is available
            HtmlControl EncryptionConsentPane = new HtmlControl(browind);

            EncryptionConsentPane.FilterProperties[HtmlDiv.PropertyNames.InnerText] = "Encryption Consent";

            // CheckBox I have read, understand, and agree to the policy above.

            //check checkbox
            HtmlCheckBox checkBox = new HtmlCheckBox(browind);

            checkBox.SearchProperties[HtmlCheckBox.PropertyNames.Id] = "encrypt_consent_ack";
            checkBox.DrawHighlight();
            Mouse.Click(checkBox);


            //chkBox.DrawHighlight();
            if (checkBox.Checked == true)
            {
                //Verify SaveNContinue button is Enable

                Assert.IsTrue(checkBox.Enabled);
                checkBox.SetProperty(HtmlCheckBox.PropertyNames.Checked, true);
                Mouse.Click(checkBox);
            }
            else
            {
                Assert.IsTrue(checkBox.Enabled, "I have read, understand, and agree to the policy above");
            }

            /*****************/
            /* Progress Meter*/
            /*****************/
            HtmlCustom progress = new HtmlCustom(browind);

            progress.SearchProperties[HtmlCustom.PropertyNames.Id] = "progressmeter";
            progress.DrawHighlight();
            bool   availabilty   = (bool)progress.GetProperty(HtmlCustom.PropertyNames.Exists);
            string workflowEvent = PersonalInformation1.ReadData(1, "WORKFLOW");

            if (workflowEvent == "S1PROSPECT")
            {
                Assert.IsTrue(availabilty, "Progress Meter is not showing");

                HtmlSpan bar = new HtmlSpan(browind);
                bar.SearchProperties[HtmlSpan.PropertyNames.Id] = "progressmeterdiv";
                bar.DrawHighlight();
                string percentage = (string)bar.GetProperty(HtmlSpan.PropertyNames.InnerText);
                Assert.AreEqual(percentage, "95%");
            }
            else
            {
                Assert.IsFalse(availabilty, "Progress Meter is showing");
            }


            //Click button Save And Continue
            HtmlSpan SaveAndContinue = new HtmlSpan(browind);

            SaveAndContinue.SearchProperties[HtmlSpan.PropertyNames.Id] = "ForwardButton_button";
            // SaveAndCountinue.DrawHighlight();
            Mouse.Click(SaveAndContinue);

            browind.WaitForControlReady(2000);
        }
 public HtmlCheckboxControlPageModelWrapper(HtmlCheckBox toWrap, TNextModel nextModel) : base(toWrap, nextModel)
 {
 }
 public static ISelectablePageModel <TNextModel> AsPageModel <TNextModel>(this HtmlCheckBox checkbox, TNextModel nextModel) where TNextModel : IPageModel
 {
     return(new HtmlCheckboxControlPageModelWrapper <TNextModel>(checkbox, nextModel));
 }
示例#13
0
 public void SetUp()
 {
     mocks       = new Mockery();
     iWebElement = mocks.NewMock <IWebElement>();
     checkBox    = new HtmlCheckBox(iWebElement);
 }
        public static void workExperienceExmpt_SaveNContinue()
        {
            //Create BrowserWindow

            BrowserWindow browind = new BrowserWindow();

            //Work Experience Exmpt pane
            browind.WaitForControlReady(20000);
            browind.SearchProperties[UITestControl.PropertyNames.Name] = "Work Experience Exempt";

            //check checkbox
            HtmlCheckBox chkBox = new HtmlCheckBox(browind);

            chkBox.SearchProperties[HtmlCheckBox.PropertyNames.Id] = "Employer1_minMonths_claim";


            //Button Save And Continue
            HtmlControl SaveCont = new HtmlControl(browind);

            SaveCont.SearchProperties[HtmlButton.PropertyNames.Id] = "ForwardButton_button";

            if (chkBox.Checked == false)
            {
                //Verify SaveNContinue button is unable
                Assert.IsFalse(SaveCont.Enabled);
                chkBox.SetProperty(HtmlCheckBox.PropertyNames.Checked, true);
            }
            else
            {
                Assert.IsTrue(SaveCont.Enabled);
            }


            // Progress Meter

            HtmlCustom progress = new HtmlCustom(browind);

            progress.SearchProperties[HtmlCustom.PropertyNames.Id] = "progressmeter";
            bool   availabilty   = (bool)progress.GetProperty(HtmlCustom.PropertyNames.Exists);
            string workflowEvent = PersonalInformation1.ReadData(1, "WORKFLOW");

            if (workflowEvent == "S1PROSPECT")
            {
                Assert.IsTrue(availabilty, "Progress Meter is not showing");

                HtmlSpan bar = new HtmlSpan(browind);
                bar.SearchProperties[HtmlSpan.PropertyNames.Id] = "meterlabel";
                string percentage = (string)bar.GetProperty(HtmlSpan.PropertyNames.InnerText);
                //Assert.AreEqual(percentage, "55%");
                Assert.AreEqual(percentage, "50%");
            }
            else
            {
                Assert.IsFalse(availabilty, "Progress Meter is showing");
            }

            //Click Save And Continue

            Mouse.Click(SaveCont);
            browind.WaitForControlReady(2000);
        }
示例#15
0
 public void CheckBox(string prefix, string id, bool value)
 {
     HtmlCheckBox CheckBox = new HtmlCheckBox(Doc);
     CheckBox.SearchProperties[HtmlRadioButton.PropertyNames.Id] = prefix + id;
     CheckBox.Checked = value;
 }
示例#16
0
 public void CheckBox(string value , bool selected) 
 {
     HtmlCheckBox cb = new HtmlCheckBox(Doc) ; 
     cb.SearchProperties[HtmlCheckBox.PropertyNames.Value] = value ;
     cb.Checked = selected;
 }