Oops -- typo 2nd example should be ie2.link(:index, 7).click should set the date to '2006-06-02'
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Attebery, Bill Sent: Thursday, June 01, 2006 4:06 PM To: [email protected] Subject: Re: [Wtr-general] How to create a script for calendar function? Try ie2.show_links to see all the links in the page and ie2.show_tables to see all the tables in the page Looking at the code snippet -- ie2.link(:text, '2').click should set the date to '2006-06-02' ie2.link(:id, ).click should set the date to '2006-06-02' Ie2.table(:index, 2)[2][6].click should set the date to '2006-06-02' ie2.table(:index, )[2][6].fireEvent('onclick') should also set the date to '2006-06-02' Also ie2.link(:text, '<<').click should move the year back ie2.link(:text, '>>').click should move the year forward ie2.link(:text, '>').click should move the month forward ie2.link(:text, 'Print').click should print (I assume) etc. Likewise ie2.table(:index, 1)[1][1].click will move the year back ie2.table(:index, 1)[1][1].fireEvent will move the year back etc. I recommend identifying the links by :text (simple to code and read) -- but there are many other ways to do the same thing. Hope this helps. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Danilova, Elza Sent: Thursday, June 01, 2006 10:34 AM To: [email protected] Subject: Re: [Wtr-general] How to create a script for calendar function? Hi, Using the following: ie.link(:url,"javascript:show_calendar'resultsearch.gDate')").click ie2=Watir::IE.attach(:title, "Calendar") we were able to open the calendar icon, but could not go any further, because there is no object name on the calendar.html page: -----------Objects in page ------------- name= id= name= id= name= id= name= id= name= id= Calendar html: html> <head><title>Calendar</title> </head> <body link="black" vlink="black" alink="black" text="black"> <FONT FACE='Verdana' SIZE=2><B>June 2006</B><BR><TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center> [<A HREF="javascript:window.opener.Build('resultsearch.gDate', '5', '2005', 'MONTH DD, YYYY');"><<</A>]</TD><TD ALIGN=center> [<A HREF="javascript:window.opener.Build('resultsearch.gDate', '4', '2006', 'MONTH DD, YYYY');"><</A>]</TD><TD ALIGN=center> [<A HREF="javascript:window.print();">Print</A>]</TD><TD ALIGN=center> [<A HREF="javascript:window.opener.Build('resultsearch.gDate', '6', '2006', 'MONTH DD, YYYY');">></A>]</TD><TD ALIGN=center> [<A HREF="javascript:window.opener.Build('resultsearch.gDate', '5', '2007', 'MONTH DD, YYYY');">>></A>]</TD></TR></TABLE><BR> <TABLE BORDER=1 BGCOLOR="white"><TR><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana' COLOR='darkgreen'><B>Sun</B></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana' COLOR='darkgreen'><B>Mon</B></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana' COLOR='darkgreen'><B>Tue</B></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana' COLOR='darkgreen'><B>Wed</B></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana' COLOR='darkgreen'><B>Thu</B></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana' COLOR='darkgreen'><B>Fri</B></FONT></TD><TD WIDTH='16%'><FONT SIZE='2' FACE='Verdana' COLOR='darkgreen'><B>Sat</B></FONT></TD></TR><TR><TD WIDTH='14%' BGCOLOR="#e0e0e0"><FONT SIZE='2' FACE='Verdana'> </FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'> </FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'> </FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'> </FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.resultsearch.gDate.value='2006-06-01';wind ow.close();"><FONT COLOR="RED"><B>1</B></FONT></A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.resultsearch.gDate.value='2006-06-02';wind ow.close();">2</A></FONT></TD><TD WIDTH='14%' BGCOLOR="#e0e0e0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.resultsearch.graDate.value='2006-06-03';wi ndow.close();">3</A></FONT></TD></TR><TR><TD WIDTH='14%' BGCOLOR="#e0e0e0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.resultsearch.gDate.value='2006-06-04';wind ow.close();">4</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.resultsearch.gDate.value='2006-06-05';wind ow.close();">5</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.resultsearch.gDate.value='2006-06-06';wind ow.close();">6</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.resultsearch.gDate.value='2006-06-07';wind ow.close();">7</A></FONT></TD></TABLE> </BODY> </HTML> -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Attebery, Bill Sent: Wednesday, May 31, 2006 6:10 PM To: [email protected] Subject: Re: [Wtr-general] How to create a script for calendar function? Not sure if all calendar functions are created equal -- the one used at my site pops up another IE window -- I can attach to it and then drive it like always. ie.image(:id, 'my_calendar_icon').click @ie2=IE.attach(:title, /Select Date/) Now @ie2 is another browser instance with select_lists, links, buttons, etc. available to control through regular watir statements. @ie2.select_list(:name, 'cboMonth').select('Jun') @ie2.select_list(:name, 'cboYear').select('2006') @ie2.link(:text, '15').click -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Fitisoff Sent: Wednesday, May 31, 2006 3:28 PM To: [email protected] Subject: Re: [Wtr-general] How to create a script for calendar function? If you aren't trying to do anything complicated - and the calendar control responds to keyboard input - you might want to try using the send_keys method to set the calendar control: ie.image(:id, "my_calendar_icon").click ie.send_keys("{UP}") ie.send_keys("{LEFT}") ie.send_keys("{ENTER}") The drawback is that this approach may not let you exercise all of the calendar control's functionality. But if you're just worried about setting a date it's probably enough to get you past the control without worrying about the Javascript. --- "Danilova, Elza" <[EMAIL PROTECTED]> wrote: > Using WATIR I am having problem to create a document that includes the > calendar function. > > How can I drive a java script to execute the calendar function, where > the text field can not be populated with the date and it's only allow > you to select a date by clicking on the calendar icon? > > Thank you, > > Elza > > > "This e-mail and any attachments may contain confidential and > privileged information. Any dissemination or use of the information by > a person other than the intended recipient is unauthorized and may be > illegal. If you are not the intended recipient, please notify the > sender immediately by return e-mail, delete this e-mail and destroy > any copies. Although this e-mail and any attachments are believed to > be free of any virus or other defect that might affect any computer > system into which it is received and opened, it is the responsibility > of the recipient to ensure that it is virus free and no responsibility > is accepted by the Board of Trade of the City of New York, Inc. or the > New York Clearing Corporation for any loss or damage arising in any > way from its use. Thank you." > > > > > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general The content contained in this electronic message is not intended to constitute formation of a contract binding TWTC. TWTC will be contractually bound only upon execution, by an authorized officer, of a contract including agreed terms and conditions or by express application of its tariffs. This message is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the sender of this E-Mail or by telephone. _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general The content contained in this electronic message is not intended to constitute formation of a contract binding TWTC. TWTC will be contractually bound only upon execution, by an authorized officer, of a contract including agreed terms and conditions or by express application of its tariffs. This message is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the sender of this E-Mail or by telephone. _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general The content contained in this electronic message is not intended to constitute formation of a contract binding TWTC. TWTC will be contractually bound only upon execution, by an authorized officer, of a contract including agreed terms and conditions or by express application of its tariffs. This message is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the sender of this E-Mail or by telephone. _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
