You have to ask yourself how much value you provide to your project by testing some third party tool beyond it's being integrated properly into your product.
If it was me, I'd look for the most expedient way to get the value I needed 'set' If the calendar has an input box that accepts my typing into it, then doing something similar to that in your tests might be the best route. As always with any tool that drives the browser (Watir, Selenium, etc) you look at 'what do I do manually to control this thing?' and then basically find ways to simulate that using the automation code. If it LETS you just click in a given spot and input a value, then that's what I'd try to automate in most of my cases (beyond one basic test that the calendar works when you pick the date that way) But some of these tools, the ONLY way to get the date into the field is by 'picking' it from the calendar, and there is no 'manual entry' option that lets you 'type' in a value. So you are stuck automating the clicking on specific cells in the calendar. To do that you need to write a script that's going to work a month or a year from now, so you'll need to go throught the motions of clicking in the portion (a sub table in the example I looked at) of the control that lets you pick the year and month, Then picking the year and month, THEN picking the day of the month. Otherwise a day from now you'll be clicking on July 30 instead of June 30 Based on the sample I looked at, almost all of those are going to be .cell elements, and hopefully just doing a 'click' on the element will work for what you need. On Jun 30, 5:51 am, Wesley Chen <[email protected]> wrote: > If you are not sure what you want to do, please try the cases you have. > > Wesley. > For life, the easier, the better. > > > > On Wed, Jun 30, 2010 at 1:38 PM, naresh <[email protected]> wrote: > > Hi, > > > I am confused in rich calender, i need to click image and then get > > elements or > > do like following > > > ie.cell(:class => "j_id354_j_id355DayCell rich-calendar-cell rich- > > calendar-btn", :text => "16").click which Linden suggested. > > > I am confused class, there is 2 classes in HTML code. > > class="rich-calendar-input " > > class="rich-calendar-button" > > which one to use. > > My requirement to select a 30-jun-2010 date from calender. > > > Regards, > > Naresh > > > On Jun 29, 8:32 pm, Chuck van der Linden <[email protected]> wrote: > > > 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 <[email protected]> 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','September','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 <[email protected]> > > > > wrote: > > > > > > On Mon, Jun 28, 2010 at 1:22 PM, naresh <[email protected]> > > 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 readhttp://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: [email protected] > > To unsubscribe: > > [email protected]<watir-general%2bunsubscr...@googlegroups.com>- > > 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: [email protected] To unsubscribe: [email protected]
