Name() public static method

Gets a mechanism to find elements by their name.
public static Name ( string nameToFind ) : By
nameToFind string The name to find.
return By
 /// <summary>
 /// Gets a mechanism to find elements by their name.
 /// </summary>
 /// <param name="nameToFind">The name to find.</param>
 /// <returns>A <see cref="OpenQA.Selenium.By"/> object the driver can use to find the elements.</returns>
 public static new SeleniumBy Name(string nameToFind) => SeleniumBy.Name(nameToFind);
 public void ShouldBeAbleToSwitchToAFrameByItsID()
 {
     driver.Url = framesetPage;
     driver.SwitchTo().Frame("fifth");
     Assert.AreEqual("Open new window", driver.FindElement(By.Name("windowOne")).Text);
 }
 public void ShouldBeAbleToSwitchToAnIframeByItsID()
 {
     driver.Url = iframePage;
     driver.SwitchTo().Frame("iframe1");
     Assert.AreEqual("name", driver.FindElement(By.Name("id-name1")).GetAttribute("value"));
 }
Beispiel #4
0
 public void FindingASingleElementByNameWithSpaceShouldThrow()
 {
     driver.Url = formsPage;
     Assert.Throws <NoSuchElementException>(() => driver.FindElement(By.Name("nonexistent button")));
 }
Beispiel #5
0
 public void FindingASingleElementByEmptyNameShouldThrow()
 {
     driver.Url = formsPage;
     Assert.Throws <NoSuchElementException>(() => driver.FindElement(By.Name("")));
 }
Beispiel #6
0
 public void ShouldNotBeAbleToLocateByNameASingleElementThatDoesNotExist()
 {
     driver.Url = formsPage;
     Assert.Throws <NoSuchElementException>(() => driver.FindElement(By.Name("nonExistentButton")));
 }
Beispiel #7
0
 public void ShouldNotBeAbleToSubmitAFormThatDoesNotExist()
 {
     driver.Url = formsPage;
     driver.FindElement(By.Name("there is no spoon")).Submit();
 }
Beispiel #8
0
 public void ShouldNotBeAbleToSubmitAFormThatDoesNotExist()
 {
     driver.Url = formsPage;
     driver.FindElement(By.Name("SearchableText")).Submit();
 }