[Wtr-general] Asking two questions related on javascript pop up window

Paul Carvalho tester.paul at gmail.com
Thu Apr 13 11:39:01 EDT 2006


Hi there.  I am a different Paul.  While I can't offer any additional help
on your first problem, I do have a few suggestions for your second question.

Unless I am misreading the code below, it looks like there is a text input
field right beside the calendar.png icon.  In our web app we have similar
places where the user can click on these calendar icons when prompted to
enter a date.  When I am scripting I just ignore the calendar popups - too
much effort required for very little gain.

Why don't you just type the date you want into the text field next to the
calendar icon?  Taking a guess from the HTML below, I would expect the
following to work:
   ie.text_field( :id, "consents_530" ).set( '12/31/2005' )    # the code
hints at the format: "%m/%d/%Y"

If you are set on scripting the pop-up calendar control, how does SpySmith
recognise the object?  In our app, the pop-up calendar appears as new table
within the Frame, not as a separate (javascript or IE) window, so I just
reference the new table's ID tag.  I played around with navigating our
calendar control using Watir but it seemed to be a waste of time.  It takes
me one line to enter a date into the input field and continue, while it
could take me over a dozen lines to do the same thing using the popup
calendar control.

Bells and whistles, man.  Just ignore them if you can work around them. =)

Good luck.  Paul.


On 13/04/06, gege qian <gegeqian at yahoo.com> wrote:

> 2)
> In our application , we have a calendar image, which user can click on for
> selecting
> the date. I do not know if there is a way to a)pop up the calendar, b)and
> select the date.
> the html source code is as follows:
> <table class="header_info"><tr valign="top"><td ><label>  *Date
> consented</label><br />
> <input class="date" id="consents_530"
> name="consents[530][date_consent_signed]" size=12 type="text" />
> <br />
> </td>
> <td ><br />
> <img alt=Calendar class=date id=consents_530_b src=/images/calendar.png
> title="Show calendar"/>
> <script type="text/javascript">
> Calendar.setup({ inputField:"consents_530", button:"consents_530_b",
> cache:true, ifFormat:"%m/%d/%Y", firstDay:0, range:[1956,2008],
> showOthers:true, step:1 })
> </script>
> </td>
> </tr>
> </table>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060413/6787ff85/attachment.html 


More information about the Wtr-general mailing list