Selenium C# – Find Element by LinkText

The below code can be used to detect any element on a WebPage by LinkText  using Selenium in C#

  • LinkText indicates any text that is between “<A>” and “</A”> tag
WebDriver.FindElementByLinkText("Login").Click();

//Code when there is Custom function


int WaitTime=10;
WebDriver.FindElement(By.LinkText("Login"),WaitTime).Click();

If there is a custom wait function as  here, then you can use the above  code also!

You may also like...