Ejemplo n.º 1
0
 public ReadOnlyCollection <IWebElement> FindElementsByClassName(string className)
 {
     if (this.driver.IsSpecificationCompliant)
     {
         return(this.FindElements("css selector", "." + RemoteWebDriver.EscapeCssSelector(className)));
     }
     return(this.FindElements("class name", className));
 }
Ejemplo n.º 2
0
 public IWebElement FindElementById(string id)
 {
     if (this.IsSpecificationCompliant)
     {
         return(this.FindElement("css selector", "#" + RemoteWebDriver.EscapeCssSelector(id)));
     }
     return(this.FindElement("id", id));
 }
Ejemplo n.º 3
0
 public ReadOnlyCollection <IWebElement> FindElementsById(string id)
 {
     if (this.driver.IsSpecificationCompliant)
     {
         return(this.FindElements("css selector", "#" + RemoteWebDriver.EscapeCssSelector(id)));
     }
     return(this.FindElements("id", id));
 }
Ejemplo n.º 4
0
        public ReadOnlyCollection <IWebElement> FindElementsByClassName(string className)
        {
            if (!this.IsSpecificationCompliant)
            {
                return(this.FindElements("class name", className));
            }
            string text = RemoteWebDriver.EscapeCssSelector(className);

            if (text.Contains(" "))
            {
                throw new InvalidSelectorException("Compound class names not allowed. Cannot have whitespace in class name. Use CSS selectors instead.");
            }
            return(this.FindElements("css selector", "." + text));
        }
Ejemplo n.º 5
0
        public ReadOnlyCollection <IWebElement> FindElementsById(string id)
        {
            if (!this.IsSpecificationCompliant)
            {
                return(this.FindElements("id", id));
            }
            string text = RemoteWebDriver.EscapeCssSelector(id);

            if (string.IsNullOrEmpty(text))
            {
                return(new List <IWebElement>().AsReadOnly());
            }
            return(this.FindElements("css selector", "#" + text));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Finds a list of elements that match the class name supplied
        /// </summary>
        /// <param name="className">CSS class name of the elements on the page</param>
        /// <returns>ReadOnlyCollection of IWebElement object so that you can interact with those objects</returns>
        /// <example>
        /// <code>
        /// IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.Firefox());
        /// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsByClassName("classname")
        /// </code>
        /// </example>
        public ReadOnlyCollection <IWebElement> FindElementsByClassName(string className)
        {
            // Element finding mechanism is not allowed by the W3C WebDriver
            // specification, but rather should be implemented as a function
            // of other finder mechanisms as documented in the spec.
            // Implementation after spec reaches recommendation should be as
            // follows:
            // return this.FindElements("css selector", "." + className);
            if (this.driver.IsSpecificationCompliant)
            {
                return(this.FindElements("css selector", "." + RemoteWebDriver.EscapeCssSelector(className)));
            }

            return(this.FindElements("class name", className));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Finds a list of elements that match the class name supplied
 /// </summary>
 /// <param name="className">CSS class name of the elements on the page</param>
 /// <returns>ReadOnlyCollection of IWebElement object so that you can interact with those objects</returns>
 /// <example>
 /// <code>
 /// IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.Firefox());
 /// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsByClassName("classname")
 /// </code>
 /// </example>
 public virtual ReadOnlyCollection <IWebElement> FindElementsByClassName(string className)
 {
     return(this.FindElements("css selector", "." + RemoteWebDriver.EscapeCssSelector(className)));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Finds the first element in the page that matches the CSS Class supplied
 /// </summary>
 /// <param name="className">CSS class name of the element on the page</param>
 /// <returns>IWebElement object so that you can interact that object</returns>
 /// <example>
 /// <code>
 /// IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.Firefox());
 /// IWebElement elem = driver.FindElementByClassName("classname")
 /// </code>
 /// </example>
 public virtual IWebElement FindElementByClassName(string className)
 {
     return(this.FindElement("css selector", "." + RemoteWebDriver.EscapeCssSelector(className)));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Finds the first element in the page that matches the ID supplied
 /// </summary>
 /// <param name="id">ID of the Element</param>
 /// <returns>ReadOnlyCollection of Elements that match the object so that you can interact that object</returns>
 /// <example>
 /// <code>
 /// IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.Firefox());
 /// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsById("id")
 /// </code>
 /// </example>
 public virtual ReadOnlyCollection <IWebElement> FindElementsById(string id)
 {
     return(this.FindElements("css selector", "#" + RemoteWebDriver.EscapeCssSelector(id)));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Finds the first element in the page that matches the ID supplied
 /// </summary>
 /// <param name="id">ID of the element</param>
 /// <returns>IWebElement object so that you can interact with that object</returns>
 /// <example>
 /// <code>
 /// IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.Firefox());
 /// IWebElement elem = driver.FindElementById("id")
 /// </code>
 /// </example>
 public virtual IWebElement FindElementById(string id)
 {
     return(this.FindElement("css selector", "#" + RemoteWebDriver.EscapeCssSelector(id)));
 }