tags:

views:

206

answers:

1

I have a page that has an image which when clicked shows a calendar. I've put an example of it here --> http://www.dotvibes.com/test/test.html Clicking on the image shows a calendar.

I tried to use Selenium IDE to record the action of clicking this image but it just does not work properly.

Here is what selenium IDE returns

<tr> click <td>//img[@name='calendarButton' and @onclick=&quot;return showCalendar('date_ceased0', 'dd/MM/yyyy');&quot;]</td> `

After clicking the image, selenium IDE does not record actual clicking of a date in the calendar. And also i cant type anything directly into the text box because for some reason it ends up being "undefined".

What do i need to do to test the image click, selecting a date including a different month? Please have a look at the example page shown above and try and record selecting a date using the IDE.

Thanks

+2  A: 

Selenium IDE doesn't record every action, so sometimes you need to play around with the commands available. The following works for me for selecting a date in your example:

click | name=calendarButton
mouseDown | css=tr.headrow td:nth-child(4)
waitForVisible | css=.combo .label:contains(Jan)
mouseOver | css=.combo .label:contains(Aug)
mouseUp | css=.combo .label:contains(Aug)
waitForNotVisible | css=.combo .label:contains(Jan)
mouseOver | css=.day:contains(10)
clickAt | css=.day:contains(10)
clickAt | css=.day:contains(10)
verifyValue | id=provisionDateP | 10/08/2010
Dave Hunt
That looks interesting. What format/language is that? Can you post the html or java equivalent. Thanks
ziggy
I managed to type that onto the ide and converted it to Java and it works flawlessly. I wasnt aware that it was possible to access it using css like that and i wasnt aware of the clickAt event either. Thanks so much for your help.
ziggy
It's just a simple text format - a bit more readable than most of the formats. The CSS locators are very useful, normally faster than locating by XPath and often safer to use across browsers. Sometimes `click` doesn't work where `clickAt` does. I expect this is due to Selenium attempting to click the centre of the element, whereas `clickAt` without the final offset parameter will click the top left of the element.
Dave Hunt