0

This question already has an answer here:

I can able to activate the drop down and able to select the value from it sometimes but sometimes i can't able to select the option for the drop down and i am facing an timeout error.

Code:

driver.findElement(By.xpath("//*[@id='tabstrip-2']/div[1]/span/span/span[2]/span")).click();
Thread.sleep(15000);
driver.findElement(By.xpath("//*[@id='ddlschedule_listbox']/li[2]")).click();

Error: Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Command duration or timeout: 35 milliseconds

marked as duplicate by Yamikuronue, Bruce McLeod Feb 18 '15 at 10:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Edit: updated reply to reflect the question better.

With this code, Selenium selects the value in the dropdown. Possibly important: the value is visible (no scrolling needed) when the list is shown. But I'm using the same index as you, so that should make no difference.

Beware, I'm not sure which demo page you used, I picked this one: http://demos.telerik.com/kendo-ui/dropdownlist/remotedatasource

            IWebDriver d = new FirefoxDriver();
            d.Manage().Window.Maximize();
            WebDriverWait w = new WebDriverWait(d, new TimeSpan(0, 0, 10));

            d.Navigate().GoToUrl("http://demos.telerik.com/kendo-ui/dropdownlist/remotedatasource");
            d.FindElement(By.CssSelector("span[aria-owns=\"products_listbox\"]")).Click();

            w.Until(driver => Boolean.Equals("false", d.FindElement(By.CssSelector("#products_listbox")).GetAttribute("aria-hidden")));
            d.FindElement(By.XPath("//ul[@id='products_listbox']/li[2]")).Click();
  • am using kendo ui dropdown, so the same class name is used by more than 1 element, for you information i have provided the url which is similar to my project "demos.kendoui.com/web/dropdownlist/index.html" and tell me what kind of wait i have to use.. with example..please ;) – Shanmuga Raj Feb 12 '15 at 10:00
  • Like I said, try replacing your wait with an explicit wait for the visibility of the element. You might find these replies interesting: stackoverflow.com/questions/10941184/… – FDM Feb 12 '15 at 11:00
  • But still the time out error exist...;( – Shanmuga Raj Feb 12 '15 at 13:43
  • Timeout on the wait, or on the click after it? Perhaps you should post the relevant HTML section as well. – FDM Feb 12 '15 at 17:23
  • timeout on the cluck..u can find the relevant html code in the url "demos.kendoui.com/web/dropdownlist/index.html"; – Shanmuga Raj Feb 13 '15 at 5:56

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