Exemple #1
0
        protected bool ChangeStarRating(string recordId)
        {
            try
            {
                IWebElement starRating  = Driver.FindElement(By.CssSelector(string.Format("div[data-itemid='{0}'] i:nth-child(1n)", recordId)));
                Random      randomValue = new Random();
                int         ratingValue = randomValue.Next(1, 5);
                if (ratingValue == GetCurrentStartRating(recordId))
                {
                    ratingValue = randomValue.Next(1, 5);
                }
                string elementId = string.Format("div[data-itemid='{0}'] i:nth-child({1}n)", recordId, ratingValue);
                Driver.Actions().Click(starRating);
                Driver.Actions().MoveToElement(Driver.FindElement(By.CssSelector(elementId)));
                Driver.Actions().MoveToElement(Driver.FindElement(By.CssSelector(elementId))).Click().Perform();


                return(true);
            }
            catch (NoSuchElementException ex)
            {
                logger.Error("NoSuchElementException encuntered in ChangeStarRatingForJobApplication :{0}", ex.Message);
            }
            return(false);
        }
Exemple #2
0
        protected bool FilterResultsUsingColumnFilter(string module, string columnName, string filterText)
        {
            int            initialrowCount = GetGridRowCount();
            int            currentrowCount = 0;
            ElementLocator columnFilter    = new ElementLocator(Locator.Id, "Grid_{0}_Filter_{1}");


            try
            {
                IWebElement resultFilter = Driver.GetElement(columnFilter.Format(module, columnName));


                Driver.Actions().SendKeys(resultFilter, filterText).Perform();
                Driver.Actions().SendKeys(resultFilter, Keys.Enter).Perform();
                Driver.WaitForAjax();
                currentrowCount = GetGridRowCount();
                if (initialrowCount != currentrowCount)
                {
                    return(currentrowCount == 0 ? true : Driver.PageSource.Contains(filterText));
                }
            }
            catch (TimeoutException ex)
            {
                logger.Error("Encountered exception in FilterResultsUsingColumnFilter:{0}", ex.Message);
            }
            return(false);
        }
 /// <summary>
 /// Delete newly created Rule Event
 /// </summary>
 /// <param name="RuleEvent"></param>
 /// <param name="Message"></param>
 /// <returns></returns>
 public string DeleteEvent(string RuleEvent, out string Message)
 {
     try
     {
         if (VerifyRuleInRuleEventPage(RuleEvent))
         {
             Driver.Actions().ContextClick(Driver.FindElement(By.XPath("//span[text()='" + RuleEvent + "']"))).Build().Perform();
             Driver.GetElement(Button_DeleteEvent).ClickElement();
             if (!VerifyRuleInRuleEventPage(RuleEvent))
             {
                 Message = "Rule Event " + RuleEvent + "deleted Sucessfully";
                 return(Message);
             }
             else
             {
                 Message = "Rule Event " + RuleEvent + " is not deleted ";
                 return(Message);
             }
         }
         else
         {
             Message = RuleEvent + " does not exists";
             return(Message);
         }
     }
     catch (Exception e)
     {
         throw new Exception("Failed to Delete Rule event:" + RuleEvent, e);
     }
 }
Exemple #4
0
        public bool ClickOnTree(string Tree, bool RightClick = false)
        {
            ElementLocator AttributeSet_MainTree         = new ElementLocator(Locator.XPath, "//span[contains(text(),'Attribute Sets')]//parent::div");
            ElementLocator AttributeSet_Tree             = new ElementLocator(Locator.XPath, "//span[contains(text(),'Attribute Sets')]//parent::div//following-sibling::ul//span[text()='" + Tree + "']");
            ElementLocator AttributeSet_Tree_NotExpanded = new ElementLocator(Locator.XPath, "//span[contains(text(),'Attribute Sets')]//parent::div//following-sibling::ul//span[text()='" + Tree + "']//preceding::span[1][@class='rtPlus']");
            ElementLocator AttributeSet_Tree_Expanded    = new ElementLocator(Locator.XPath, "//span[contains(text(),'Attribute Sets')]//parent::div//following-sibling::ul//span[text()='" + Tree + "']//preceding::span[1][@class='rtMinus']");

            if (Driver.IsElementPresent(AttributeSet_MainTree, 1) && Driver.IsElementPresent(AttributeSet_Tree_NotExpanded, 1))
            {
                Driver.GetElement(AttributeSet_Tree).ScrollToElement();
                Driver.GetElement(AttributeSet_Tree).ClickElement();
                Driver.GetElement(AttributeSet_Tree_NotExpanded).ClickElement();

                return(true);
            }
            if (Driver.IsElementPresent(AttributeSet_MainTree, 1) && Driver.IsElementPresent(AttributeSet_Tree, 1))

            {
                Driver.GetElement(AttributeSet_Tree).ScrollToElement();
                Driver.GetElement(AttributeSet_Tree).ClickElement();
                if (RightClick)
                {
                    Driver.Actions().ContextClick(Driver.GetElement(AttributeSet_Tree)).Build().Perform();
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
 public bool ClickOnChild(string Tree, string Node, string Child)
 {
     if (ClickOnNode(Tree, Node))
     {
         ElementLocator Attribute_Child = new ElementLocator(Locator.XPath, "//span[contains(text(),'Attribute Sets')]//parent::div//following-sibling::ul//span[text()='" + Tree + "']//parent::div//following-sibling::ul//span[text()='" + Node + "']//parent::div//following-sibling::ul//span[text()='" + Child + "']");
         if (Driver.IsElementPresent(Attribute_Child, 1))
         {
             Driver.GetElement(Attribute_Child).ScrollToElement();
             Driver.GetElement(Attribute_Child).ClickElement();
             Driver.Actions().ContextClick(Driver.GetElement(Attribute_Child)).Build().Perform();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
        public bool CreateNewEvent(string RuleEvent, out string Message)
        {
            if (Driver.IsElementPresent(Menu(RuleEvent), 1))
            {
                Message = "Rule Event Already Available:" + RuleEvent;
                return(true);
            }
            else
            {
                Driver.Actions().ContextClick(Driver.GetElement(Tree_RuleEvents)).Build().Perform();
                Driver.GetElement(Left_Menu).ClickElement();
                Driver.GetElement(TextBox_EventName).SendText(RuleEvent);
                Driver.GetElement(TextBox_DisplayText).SendText(RuleEvent);
                Driver.GetElement(Button_EventSave).ClickElement();
                if (Driver.IsElementPresent(Menu(RuleEvent), 1))
                {
                    Message = "Rule Event Created Successfully ;Rule Event Details" + RuleEvent;

                    return(true);
                }
            }
            throw new Exception("Failed to Create Rule event:" + RuleEvent);
        }