WebDriver FindElement by ID in Selenium C#

The below code can be used to detect an element by ID in  C#

WebDriver.FindElementById("Login").Click();

And if you have a custom wait you can find an element using an explicit wait as shown below

WebDriver.FindElement(By.id("Login"),10).Click()

The above code will wait for 10 seconds to find the element by called “Login” and if it’s element not found, Selenium will display “Element not Found” error

 

You may also like...