Noghama Omogun
Noghama Omogun

Reputation: 21

How to wait for a SelectElement

I have encountered an issue with how to wait for drop down element using selenium webdriver. I have a drop down element i wish to wait for before selecting an element from it. I have tried using the following code. can anyone Please help in c# please

{
    WebDriverWait wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));

    var waiting=   wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.Id("foo")));

    //The Dom is refreshed at this stage, and a staleelementReferenceException is thrown.

    SelectElement ddl = new SelectElement(waiting[0]);

    ddl.SelectByText("itemToBeSelected");
}

Upvotes: 2

Views: 706

Answers (1)

DGautam
DGautam

Reputation: 19

in java i used wait.until(ExpectedConditions.visibilityOfElementLocated(By locator) try to use visibilityOfElementLocated in C# maybe that will work

Upvotes: 1

Related Questions