Search code examples
c#seleniumautomationwebdriverselenium-chromedriver

WebDriverWait in Chrome, Selenium C#


I have recently changed my WebDriver from Firefox to ChromeDriver and the wait steps I previously used to wait until an element could be interacted with no longer works"

WebDriverWait w = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); w.IgnoreExceptionTypes(typeof(StaleElementReferenceException), typeof(InvalidElementStateException)); w.Until(ExpectedConditions.ElementExists(By.Id("formSubmit")));

I now often get errors like "Element is not clickable at point (964, 776). Other element would receive the click: " for example, even though the element is visible on the page.

Is there a way of telling the webdriver to wait until an element can be interacted with, or better, any settings that I could change to let Selenium know that I'm using Chrome so that my existing code works?


Solution

  • Latest version of Selenium C# Binding(2.46) provides a method to Expected Conditions named ElementToBeClickable. Try that instead. This is a very common issue with Chrome though.