public ReadOnlyCollection <IWebElement> FindElementsByClassName(string className) { if (this.driver.IsSpecificationCompliant) { return(this.FindElements("css selector", "." + RemoteWebDriver.EscapeCssSelector(className))); } return(this.FindElements("class name", className)); }
public IWebElement FindElementById(string id) { if (this.IsSpecificationCompliant) { return(this.FindElement("css selector", "#" + RemoteWebDriver.EscapeCssSelector(id))); } return(this.FindElement("id", id)); }
public ReadOnlyCollection <IWebElement> FindElementsById(string id) { if (this.driver.IsSpecificationCompliant) { return(this.FindElements("css selector", "#" + RemoteWebDriver.EscapeCssSelector(id))); } return(this.FindElements("id", id)); }
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)); }
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)); }
/// <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)); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }