Exemplo n.º 1
0
 /// <summary>
 /// Returns an element found by either CSS, ID or XPath based on the locator file.
 /// </summary>
 public static IWebElement GetElement(IWebDriver driver, LocatorReader reader, string locatorPath, string additionalLocatorPath = "")
 {
     if(reader.GetLocator(locatorPath).StartsWith("//"))
     {
         return GetElementByXPath(driver, reader, locatorPath, additionalLocatorPath);
     }
     else if(reader.GetLocator(locatorPath).StartsWith("css"))
     {
         return GetElementByCSS(driver, reader, locatorPath, additionalLocatorPath);
     }
     else
     {
         return GetElementByID(driver, reader, locatorPath, additionalLocatorPath);
     }
 }
Exemplo n.º 2
0
 public LoginScreenReader()
 {
     this.loginScreenReader = new LocatorReader(this.application, "LoginScreen.xml");
 }
Exemplo n.º 3
0
        /// <summary>
        /// Returns an element found by its cascading stylesheet (CSS) selector.
        /// </summary>
        public static IWebElement GetElementByCSS(IWebDriver driver, LocatorReader reader, string locatorPath, string additionalLocatorPath = "")
        {
            locatorPath = locatorPath.Replace("css=", string.Empty);

            return driver.FindElement(By.CssSelector(string.Format(reader.GetLocator(locatorPath), additionalLocatorPath)));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns a list of elements by their ID.
        /// </summary>
        /// <returns></returns>
        public static IList<IWebElement> GetElementsByXPath(IWebDriver driver, LocatorReader reader, string locatorPath, string additionalLocatorPath = "")
        {
            IList<IWebElement> elements = driver.FindElements(By.XPath(string.Format(reader.GetLocator(locatorPath), additionalLocatorPath)));

            return elements;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Returns an element found by its XPath query.
 /// </summary>
 public static IWebElement GetElementByXPath(IWebDriver driver, LocatorReader reader, string locatorPath, string additionalLocatorPath = "")
 {
     return driver.FindElement(By.XPath(string.Format(reader.GetLocator(locatorPath), additionalLocatorPath)));
 }