If it's the same as the sample that was linked early in the thread,
when this control is rendered in the UI, it is a series of table
cells, and each cell is 'wired' for a number of events.   You may need
to experiment with what events are fired in what order, I'd start
however with trying the following

What you are looking at is structured around a table, and each date is
a cell.  Because some dates appear more than once you cannot reliably
identify by the cell text alone, and will need to use some other means
to identify the 'right' type of cell that has the right text.   The ID
is completely positional within the grid, meaning that it's
relationship to the date will be different each month (7
possibilties).  that makes using ID to get the right cell a total
pain.  This would seem to make the best option to utilize the CLASS of
the cell, since the controll uses a small set of potential classes
(borders, holidays, workdays)    So using Class along with Text might
be your best bet, presuming of course that you want to pick a date in
the current month of the current year etc.  (otherwise you are going
to need to first click in the navigation cell, part of an inner table,
that lets you pick month and year.  OTOH since those values are
unique, you should be able to select them by cell text alone.

..  So it will depend on if you test uses some date relative to
'today' or is always picking the same date.  Relative to Today is
fairly easy given Ruby's fairly robust stuff for handling dates, but
is problimatic in that the date could end up falling on a holiday,
meaning it would be difficult to predict the cell's class ahead of
time

If you are going to always pick the same date, choose one that is NOT
in the current month, otherwise your script will break as soon as the
month changes.  This means you will first need to set the calendar
control to a specific year and month, THEN pick your day of the week.

Identify it as a Cell element within a Table,   In the example the
main table container in the example has the Class "rich-calendar-
exterior rich-calendar-popup undefined"

The cells for dates have three potential classes, there's a special
one for 'border' days (the dates in the months before or after the
current month) one for the 'holidays' (sat and sun) and one for the
weekdays of the current month..

If I wanted to pick a weekday of the current month, then once the
proper thing is clicked to make the calendar visiable (rendered) you
could so something along these lines I think

browser.cell(:class => "j_id354_j_id355DayCell rich-calendar-cell rich-
calendar-btn", :text => "16").click

Since I'm not too sure of the first part of that class (might be
dynamically created) you might have to use a regular expression just
using the second part   (/rich-calendar-cell rich-calendar-btn/)  in
order to reliably identify the cell by class and text.

(that presumes just doing a click is good enough, potentially you
might have to fire other events, you'll need to experiment)

The IE developer Toolbar is a great help in making sense of controls
like this, as it allows you to view the control as it is rendered into
the DOM,  (Firebug has similary abilities, I just know how to use the
IE tool better, so it's what I use)

On Jun 28, 5:07 am, naresh <nareshvatsa...@gmail.com> wrote:
> Hi All,
>
> i am using internet explorer to test my web application.
> I have to click save button in my application to create record.
> I am able to set value for textfield,radibutton,selectlist in watir
> script ,
> but not able to set/pickup  value for calender.
> This calender is rich calender<rich:calender> from Rcihfaces.
> The html code generated i am pasting once again.
> I want to pick up date like 28-May-2010 or any other date.
>
> <div id="globalForm:startDateDecorate">
>     <div class="prop"><label
> for="globalForm:startDateDecorate:startDate" class="name ">Start
> Date:</label>
>  <span class="value "><span
> id="globalForm:startDateDecorate:startDatePopup">
> <input class="rich-calendar-input "
> id="globalForm:startDateDecorate:startDateInputDate"
> name="globalForm:startDateDecorate:startDateInputDate"
> style="vertical-
> align: middle; " type="text" /><img alt="" class="rich-calendar-button
> " id="globalForm:startDateDecorate:startDatePopupButton"
> style="vertical-align: middle" src="/venus/a4j/g/
> 3_3_1.GAorg.richfaces.renderkit.html.iconimages.CalendarIcon/DATB/
> eAE7fv4Kw6znAA4mA-w_" /><input
> id="globalForm:startDateDecorate:startDateInputCurrentDate"
> name="globalForm:startDateDecorate:startDateInputCurrentDate"
> style="display:none" type="hidden" value="06/2010" /></span><div
> id="globalForm:startDateDecorate:startDateIFrame" style="display:
> none;"></div><div id="globalForm:startDateDecorate:startDate"
> style="display: none;"></div><div
> id="globalForm:startDateDecorate:startDateScript" style="display:
> none;"><script type="text/javascript">new
> Calendar('globalForm:startDateDecorate:startDate', {dayListTableId:
> 'globalForm:startDateDecorate:startDateDay',
>                         weekNumberBarId:
> 'globalForm:startDateDecorate:startDateWeekNum',
>                         weekDayBarId:
> 'globalForm:startDateDecorate:startDateWeekDay',
>                         currentDate: new Date(2010,5,25),
>                         selectedDate: null,
>                         datePattern: 'dd-MM-yyyy',
>                         jointPoint: 'bottom-left',
>                         direction: 'bottom-right',
>                         boundaryDatesMode:'inactive',
>                         popup: true,
>                         enableManualInput: true,
>                         showInput: true,
>                         disabled: false,
>                         readonly: false,
>                         ajaxSingle: true,
>                         verticalOffset:0,
>                         horizontalOffset: 0,
>                         style:'z-index: 3; ',
>                         firstWeekDay: 0,
>                         minDaysInFirstWeek: 1,
>                         todayControlMode:'select',
>                         showHeader:true,
>                         showFooter:true,
>                         showWeeksBar:true,
>                         showWeekDaysBar:true,
>                         showApplyButton:false,
>                         resetTimeOnDateSelect:false,
>                         defaultTime:{hours:12,minutes:0},
>  labels:{apply:'Apply', today:'Today', clean:'Clean', cancel:'Cancel',
> ok:'OK', close:'x'},
> 'monthLabels':
> ['January','February','March','April','May','June','July','August','Septemb­er','October','November','December']
>  ,
> 'monthLabelsShort':
> ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'] ,
> 'weekDayLabels':
> ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] ,
> 'weekDayLabelsShort':
> ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] }).load();</script></div>
>         </span>
>  <span class="error">
>  </span>
> </div></div>
>
> On Jun 28, 4:29 pm, Željko Filipin <zeljko.fili...@wa-research.ch>
> wrote:
>
>
>
> > On Mon, Jun 28, 2010 at 1:22 PM, naresh <nareshvatsa...@gmail.com> wrote:
> > > i want to click calender
>
> > I am asking what do you need to click. Do you know how to use a tool like
> > Firebug?
>
> >http://getfirebug.com/
>
> > Željko- Hide quoted text -
>
> - Show quoted text -

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com

Reply via email to