webdriver - wait for element
===

So, I needed something similar to waitForElementPresent to check whether something is displayed before I clicked it. I thought the implicitlyWait should cover this, so I used

    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

and then clicked by

    driver.findElement(By.id(prop.getProperty(vName))).click();

Unfortunately sometimes it waited for the element and sometimes not. I looked for a while and found this solution :

    if (second >= 10)
    fail("timeout : " + vName);
    try {
    if (driver.findElement(By.id(prop.getProperty(vName)).isDisplayed()
    break;
    } catch (Exception e) {
    }

And it waited all right, but before timing out it had to wait 10 times 5, 50 seconds. A bit much. So I set the implicitly wait to 1sec and all seemed fine until now. Cause now some things wait 10s before timeout but some other things time out after 1s.

How do you cover the waiting for element present/visible in your code? Any hints appreciated.