ClassName() публичный статический Метод

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.
Результат 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);
Пример #2
0
 public void FindingMultipleElementsByInvalidClassNameShouldThrow()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws(Is.InstanceOf <NoSuchElementException>(), () => { driver.FindElements(By.ClassName("!@#$%^&*")); });
 }
Пример #3
0
 public void FindingASingleElementByEmptyClassNameShouldThrow()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws(Is.InstanceOf <NoSuchElementException>(), () => { driver.FindElement(By.ClassName("")); });
 }
Пример #4
0
 public void FindingMultipleElementsByCompoundClassNameShouldThrow()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws <InvalidSelectorException>(() => driver.FindElements(By.ClassName("a b")));
 }
Пример #5
0
 public void ShouldNotFindElementByClassWhenTheNameQueriedIsShorterThanCandidateName()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws <NoSuchElementException>(() => driver.FindElement(By.ClassName("nameB")));
 }