How to automate DatePicker in Selenium IDE?

selenium-ide

Solution

This will vary greatly depending on how your datepicker is coded. For example, I'm working on a Web app that utilizes Dojo and I'm using the following code to select a specific position within the datepicker pop-up instead of a particular date (because the actual date isn't important for my tests):

<tr>
    <td>waitForElementPresent</td>
    <td>//*[@id=&quot;startDate&quot;]</td>
    <td></td>
</tr>
<tr>
    <td>clickAt</td>
    <td>xpath=(//input[@value='▼ '])[3]</td>
    <td></td>
</tr>
<tr>
    <td>waitForElementPresent</td>
    <td>//table[@id='startDate_popup']/tbody/tr/td[4]/span</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//table[@id='startDate_popup']/tbody/tr/td[4]/span</td>
    <td></td>
</tr>

I use `waitForElementPresent` frequently to make sure the JavaScript has time to complete running before the next step in the test is executed.

I've also found that `clickAt` is useful when clicking within Dojo widgets, and I typically prefer to use XPath for specific targets.

I hope this helps!

Problem

``` <tr> <td>type</td> <td>id=release_date</td> <td>2012-09-30</td> </tr> ``` This works but I don't want to type the date but pick it using DatePicker and try automating it.

Original source