public static LinkText ( string linkTextToFind ) : |
||
linkTextToFind | string | The link text to find. |
return |
public void GivenThatIAmOnTheSportsAZPage() { driver = new ChromeDriver { Url = "https://www.bbc.co.uk/sport/all-sports" }; var element = driver.FindElement(By.LinkText("Tennis")); Actions actions = new Actions(driver); actions.MoveToElement(element); }
/// <summary> /// Open the page for a search result using linktext /// </summary> /// <param name="result">The text of the record to be opened</param> public override void SelectSearchResult(string result) { var name = _driver.FindElement(By.LinkText(result)); name.WaitAndClick(_driver); var openApplicationLink = _driver.FindElement(By.CssSelector(".popover-content a")); var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(30)); wait.Until(ExpectedConditions.ElementToBeClickable(openApplicationLink)); openApplicationLink.WaitAndClick(_driver); }
/// <summary> /// Click the 'Open Employee Record' link that appears after clicking an employee record in the search results /// </summary> private void OpenEmployeeRecord() { var openEmployeeRecordLink = _driver.FindElement(By.LinkText("Open Employee Record")); openEmployeeRecordLink.WaitAndClick(_driver); }
/// <summary> /// Click the 'Open Vavancy' link that appears after clicking a vacancy record in the search results /// </summary> private void OpenVacancy() { var openVacancyLink = _driver.FindElement(By.LinkText("Show Applicants")); openVacancyLink.WaitAndClick(_driver); }
/// <summary> /// Click the 'Open Application' link that appears after clicking an applicant record in the search results /// </summary> private void OpenApplication() { var openApplicationLink = _driver.FindElement(By.LinkText("Open Application")); openApplicationLink.WaitAndClick(_driver); }
/// <summary> /// Gets a mechanism to find elements by their link text. /// </summary> /// <param name="linkTextToFind">The link text to find.</param> /// <returns>A <see cref="OpenQA.Selenium.By"/> object the driver can use to find the elements.</returns> public static new SeleniumBy LinkText(string linkTextToFind) => SeleniumBy.LinkText(linkTextToFind);
public void ShouldNotBeAbleToLocateByLinkTextASingleElementThatDoesNotExist() { driver.Url = xhtmlTestPage; Assert.Throws <NoSuchElementException>(() => driver.FindElement(By.LinkText("Not here either"))); }
public void ThenIAmNavigatedToTheTennisTab() { Assert.That(driver.FindElement(By.LinkText("Tennis")).Displayed); driver.Quit(); }