ClassName() public static méthode

Gets a mechanism to find elements by their CSS class.
If an element has many classes then this will match against each of them. For example if the value is "one two onone", then the following values for the className parameter will match: "one" and "two".
public static ClassName ( string classNameToFind ) : By
classNameToFind string The CSS class to find.
Résultat By
 /// <summary>
 /// Gets a mechanism to find elements by their CSS class.
 /// </summary>
 /// <param name="classNameToFind">The CSS class to find.</param>
 /// <returns>A <see cref="OpenQA.Selenium.By"/> object the driver can use to find the elements.</returns>
 public static new SeleniumBy ClassName(string classNameToFind) => SeleniumBy.ClassName(classNameToFind);
Exemple #2
0
 public void FindingMultipleElementsByInvalidClassNameShouldThrow()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws(Is.InstanceOf <NoSuchElementException>(), () => { driver.FindElements(By.ClassName("!@#$%^&*")); });
 }
Exemple #3
0
 public void FindingASingleElementByEmptyClassNameShouldThrow()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws(Is.InstanceOf <NoSuchElementException>(), () => { driver.FindElement(By.ClassName("")); });
 }
Exemple #4
0
 public void FindingMultipleElementsByCompoundClassNameShouldThrow()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws <InvalidSelectorException>(() => driver.FindElements(By.ClassName("a b")));
 }
Exemple #5
0
 public void ShouldNotFindElementByClassWhenTheNameQueriedIsShorterThanCandidateName()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws <NoSuchElementException>(() => driver.FindElement(By.ClassName("nameB")));
 }