Guys, I have started to work on selenium web driver. You can assume I am a beginner. At the moment I am having difficulties in implementing the implicit wait command in my c
As per the documentation, an Implicit Wait is to tell the WebDriver to poll the HTML DOM for a certain amount of time when trying to find an element()
or find all elements()
if they are not immediately available. But availability of an element in the DOM Tree doesn't guarantees that the ElementToBeClickable as you have tried in your code block. Hence you face the exception
as Element not found.
So the solution to your issue is to induce Explicit Wait i.e. WebDriverWait with ExpectedConditions clause as ElementToBeClickable which will not only confirm the availability of an element in the HTML DOM but also ensure that the Element is Clickable i.e. Element is Displayed and Enabled as follows:
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
IWebElement element = wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("loginlink")));