コード例 #1
0
        /// <summary>
        /// This Method is used to IntializeFramework DB
        /// </summary>
        /// <param name="StandardAttributeSet"></param>
        /// <param name="StandardProgramSet"></param>
        /// <returns>
        /// Output with boolean type as True on Successful connection of DB
        /// </returns>
        public bool InitializeFrameworkDB(bool StandardAttributeSet, bool StandardProgramSet, out string Output)
        {
            if (Driver.IsElementPresent(LoyaltyNavigator, 1))
            {
                string versionhistory = Driver.GetElement(VersionAfterInitialize).GetTextContent();
                Output = "DB Initialization is Completed before and available  version history:" + versionhistory;
                // Output = "New DB Initialization is Completed";
                return(true);
            }
            else
            {
                Checkbox _StandardAttributeSet = new Checkbox(Driver.GetElement(this.StandardAttributeSet));
                if (StandardAttributeSet)
                {
                    _StandardAttributeSet.TickCheckbox();
                }
                Checkbox _StandardProgramSet = new Checkbox(Driver.GetElement(this.StandardProgramSet));
                if (StandardProgramSet)
                {
                    _StandardProgramSet.TickCheckbox();
                }
                Driver.GetElement(InitializeFrameworkDB_Button).ClickElement();
                try
                {
                    Driver.SwitchTo().Alert().Accept();
                }
                catch (NoAlertPresentException) { }
                Thread.Sleep(60000);
                Output = "New DB Initialization is Completed";
                return(true);
                //if (Driver.IsElementPresent(LoyaltyNavigator, 14))
                //{
                //    string versionhistory = Driver.GetElement(VersionAfterInitialize).GetTextContent();
                //    Output = "DB Initialization is Completed Successfully and available  version history:" + versionhistory;
                //    return true;
                //}
                //else
                //{
                //    throw new Exception("DB Initialization Failed refer screenshot for more info");

                //}
            }
        }
コード例 #2
0
        public string CreateAttributes(string Tree, string Node, string Attributename, string AttributeDisplayText, string AttributeAlias, string AttributeType, string AttributeMinLength, string AttributeMaxLength)
        {
            ElementLocator AttributeElement = new ElementLocator(Locator.XPath, "//span[text()='" + Attributename + "' and (contains(@id,'AttributesName'))]");

            try
            {
                if (Driver.IsElementPresent(AttributeElement, .1))
                {
                    return("Attribute Element is Already Available");
                }
                else
                {
                    ClickOnNode(Tree, Node);
                    Driver.GetElement(CreateAttributeButton).ScrollToElement();

                    Driver.GetElement(CreateAttributeButton).ClickElement();
                    Driver.GetElement(AttributeName).SendText(Attributename);
                    Driver.GetElement(this.AttributeDisplayText).SendText(AttributeDisplayText);
                    Driver.GetElement(this.AttributeAlias).SendText(AttributeAlias);
                    Select Attributetype = new Select(Driver.GetElement(this.AttributeType));
                    Attributetype.SelectByText(AttributeType);
                    Checkbox AttributeVisibleonGrid_CheckBox = new Checkbox(Driver.GetElement(AttributeVisibleonGridCheckBox));
                    AttributeVisibleonGrid_CheckBox.TickCheckbox();
                    Driver.GetElement(this.AttributeAlias).SendText(AttributeAlias);
                    Driver.GetElement(this.AttributeMinLength).SendText(AttributeMinLength);
                    Driver.GetElement(this.AttributeMaxLength).SendText(AttributeMaxLength);
                    Driver.GetElement(AttributeSave).ScrollToElement();
                    Driver.GetElement(AttributeSave).ClickElement();
                    return("Attribute Element is Created Successfully");
                }
            }
            catch (Exception)
            {
                throw new Exception("Failed to Create Attributes" + Tree + " and Attribute sets:" + Node + "Refer screenshot for more info");
            }
        }