예제 #1
0
        /// <summary>
        /// Find Webelement through using by the key-value of the Dictionary class
        /// </summary>
        /// <param name="locator">Dictionary value from the Locator JSON files</param>
        /// <returns></returns>
        public IWebElement FindElement(Dictionary <string, string> locator)
        {
            IWebElement element = null;

            element = element ?? FindElementFactory.FindElement <FindElementByXpath>(WebDriver).GetElement(locator["xpath"]);
            element = element ?? FindElementFactory.FindElement <FindElementById>(WebDriver).GetElement(locator["id"]);

            return(element);
        }
예제 #2
0
 /// <summary>
 /// Set the Webelement as a List if there are more that one of the same element
 /// Using by the key-value pair of the Dictionary class
 /// </summary>
 /// <param name="locator">Dictionary value from the Locator JSON files</param>
 /// <returns></returns>
 public ICollection <IWebElement> FindElements(Dictionary <string, string> locator)
 {
     try
     {
         IList <IWebElement> element = null;
         element = element ?? FindElementFactory.FindElement <FindElementByXpath>(WebDriver).GetElements(locator["xpath"]);
         element = element ?? FindElementFactory.FindElement <FindElementById>(WebDriver).GetElements(locator["id"]);
         return(element);
     }
     catch (Exception ex)
     {
         throw new ConduentUIAutomationException(ex.Message);
     }
 }