Search code examples
selenium-webdriverrichfaces

Selenium cannot determine if richfaces calendar is disabled


I have a rich calendar:

<rich:calendar id="calendarId" disabled="true"..... />

And I try to determine with selenium if the calendar element is disabled

webDriver.findElement(By.id("calendarId")).isEnabled();

The result is true, despite of my calendar being disabled.

It is a known issue with this rich:calendar and selenium? Does anyone know how can I determine if the calendar is disabled?


Solution

  • Just use:

    webDriver.findElement(By.id("calendarIdInputDate")).isEnabled();
    

    It should be clientID of component + "InputDate" (which is a suffix added to input in calendar in RichFaces). It's because HTML element with id="calendarId" is just DIV wrapper for the rest of the component and it has no disabled attribute.