1

I found an answer here (How can I handle ElementNotInteractableException?)

I'm sure was highly effective. However now in C# It seems like the ExpectedConditions Class has been retired and is no longer available. Any ideas on how to solve this issue without this class that is no longer available?

There are some packages in Nuget it looks like, but I've seen people say they are old and not being maintained. (https://intellipaat.com/community/6974/c-selenium-expectedconditions-is-obsolete)

1

I faced same problem, so I tried this code I found in stackoverflow.

var wait = new WebDriverWait(driver, new TimeSpan(0, 0, 30));
var element = wait.Until(condition =>
{
    try
    {
        var elementToBeDisplayed = driver.FindElement(By.Id("content-section"));
        if(elementToBeDisplayed.Displayed) 
        {
            return elementToBeDisplayed;
        }
      return null;
    }
    catch (StaleElementReferenceException)
    {
        return false;
    }
    catch (NoSuchElementException)
    {
        return false;
    }
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.