I am using Selenium 2.2.
I am trying to click on elements that do not appear at first but become visible during the test. At first, sometimes the webdriver worked too fast, so the Elements were not visible in time, which led to ElementNotVisibleExceptions. I added WebDriverWait to make these elements visible / clickable. But now I get this random error when using
WebDriverWait.until(ExpectedConditions.visibilityOfElementLocated(By.id("id")));
for
WebDriverWait.until(ExpectedConditions.elementToBeClickable(By.id("id")));
here is stacktrace
org.openqa.selenium.WebDriverException: Error determining if element is displayed (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 219 milliseconds Build info: version: '2.20.0', revision: '16008', time: '2012-02-27 19:03:59' System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1 build 2600 Service Pack 3', java.version: '1.6.0' Driver info: driver.version: RemoteWebDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:44) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:516) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:170) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:123) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:438) at org.openqa.selenium.remote.RemoteWebElement.isDisplayed(RemoteWebElement.java:280) at org.openqa.selenium.support.ui.ExpectedConditions.elementIfVisible(ExpectedConditions.java:136) at org.openqa.selenium.support.ui.ExpectedConditions.access$1(ExpectedConditions.java:135) at org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:106) at org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:1) at org.openqa.selenium.support.ui.ExpectedConditions$11.apply(ExpectedConditions.java:252) at org.openqa.selenium.support.ui.ExpectedConditions$11.apply(ExpectedConditions.java:1) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:201) at MyTest.myTest(MyTest.java:xx) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:243) at junit.framework.TestSuite.run(TestSuite.java:238) at junit.framework.TestSuite.runTest(TestSuite.java:243) at junit.framework.TestSuite.run(TestSuite.java:238) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
This happens only occasionally. Ignoring a WebDriverException may solve this problem, but it doesn't seem like a clean solution. This cannot be a timeout problem, because I tried to set a timeout limit of one minute or more, and it still doesn't work after a couple of milliseconds.
Has anyone got a clean solution?
Thank you in advance
Edit: by the way. I am using InternetExplorerDriver
source share