If you are looking to gather performance information, you might find the following article useful. Hope this helps.
http://www.informit.com/articles/printerfriendly.asp?p=370634&rl=1 On 6/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Send Wtr-general mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://rubyforge.org/mailman/listinfo/wtr-general > or, via email, send a message with subject or body 'help' to > [EMAIL PROTECTED] > > You can reach the person managing the list at > [EMAIL PROTECTED] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Wtr-general digest..." > > > Today's Topics: > > 1. Re: [question] Setting timeout for a ie.wait method? > (Rodrigo Julian Martin) > 2. Re: Methods that can be used within a frame? (David Schmidt) > 3. Re: Determine HTML property (David Schmidt) > 4. Re: Methods that can be used within a frame? (Tyler Prete) > 5. Re: Methods that can be used within a frame? (Bret Pettichord) > 6. Re: How to create a script for calendar function? (Attebery, Bill) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 1 Jun 2006 17:22:41 -0300 > From: "Rodrigo Julian Martin" <[EMAIL PROTECTED]> > Subject: Re: [Wtr-general] [question] Setting timeout for a ie.wait > method? > To: <[email protected]> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="us-ascii" > > Thanks for all your replies... > > > > The Chris McMahon answer doesn't fit exactly with what I'm trying to do, > but maybe is a good approach... > > > > Bret, with the assert sentence, can I say something like... If assert > fails, do some code? > > > > John, I can't understand your code, I guess I'm too newbie to OO > programming...Are you waiting always for 30 seconds? Could this be > parametrized too? > > > > Thanks again to all of you! > > > > > > ________________________________ > > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord > Sent: Jueves, 01 de Junio de 2006 03:50 p.m. > To: [email protected] > Subject: Re: [Wtr-general] [question] Setting timeout for a ie.wait > method? > > > > The problem is that link().click won't return until the page is loaded. > Maybe you meant to use link().ole_object.click instead? > > Bret > > On 6/1/06, Chris McMahon <[EMAIL PROTECTED]> wrote: > > > P.S. I have my doubts about McMahon's suggestion. > > :) > I'm doing something very similar to this in my current Watir scripts > right now, except I haven't put in the max-retries logic yet. > -Chris > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://rubyforge.org/pipermail/wtr-general/attachments/20060601/9c2bd723/attachment-0001.htm > > ------------------------------ > > Message: 2 > Date: Thu, 01 Jun 2006 13:23:04 -0700 > From: David Schmidt <[EMAIL PROTECTED]> > Subject: Re: [Wtr-general] Methods that can be used within a frame? > To: [email protected] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Tyler, > > What I've done in the past is to create a new method, Element#html= > which allows you to replace the outerHTML for any element: > > class Watir::Element > def html=(new_html) > assert_exists > @o.outerHTML = new_html > end > end > > Unfortunately, when playing with your top level document that contains > the frameset there wasn't any Watir::Element I could grab. I tried > doing it manually by taking different document elements on that top page > and trying to do the change like: > > ie.document.body.outerhtml = "<BODY>test</BODY>" > > Even though e.document.body.ole_put_methods shows that we should be able > to do this (an outerHTML put call exists) when tried I got the following > error: > > irb(main):029:0> ie.document.body.outerhtml = "<BODY>test</BODY>" > WIN32OLERuntimeError: > OLE error code:800A0258 in htmlfile > <No Description> > HRESULT error code:0x80020009 > Exception occurred. > from (irb):29:in `method_missing' > from (irb):29 > > So in Tyler's case, I was unable to find a way to change the frame > element in his top HTML. However, I often use this replacement > technique to prevent popups by changing the HTML attributes like this: > > ie.text_field(:id, 'xxx').html = ie.text_field(:id, 'xxx').html.sub(/ > onclick=\S+/, '') > > which clears out the onclick=... from the element. > > David > > Bret Pettichord wrote: > > On 6/1/06, *Tyler Prete* <[EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > Well I may not even have to deal with it anymore, but how would I > > change this manually? I do not have control over the HTML in the > > page, I am only interacting with it via Watir. > > > > > > By design, Watir is a tool for automating things that you can do > > manually. If you don't know how to do it manually, then Watir is > > probably the wrong tool for you. > > > > Bret > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Wtr-general mailing list > > [email protected] > > http://rubyforge.org/mailman/listinfo/wtr-general > > > > > ------------------------------ > > Message: 3 > Date: Thu, 01 Jun 2006 13:23:14 -0700 > From: David Schmidt <[EMAIL PROTECTED]> > Subject: Re: [Wtr-general] Determine HTML property > To: [email protected], [EMAIL PROTECTED] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Zeljko Filipin wrote: > > ie.radio(:id, "id").readonly? > > > > On 6/1/06, *Adrian Rutter* <[EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > > > Hi, > > > > I have an HTML field that once saved becomes read-only > > [readonly="true"]. > > Apart from doing a regex on the source how can I determine this > > property? > > > > Cheers > > > > Aidy > > > I've just encountered a situation where this doesn't work, and written a > fix for it, though I'm not sure where this fix would best be integrated. > > The problem is that while an input element may NOT be read only, a > containing element like a table cell, table row or div may have their > visibility turned off, which prevents Watir from setting the focus on > the input element and effectively makes the input element read only even > though the readonly attribute is false: > > irb(main):014:0> ie.text_field(:id, 'Detail_Date').readonly? > => false > irb(main):015:0> ie.text_field(:id, 'Detail_Date').set('01/01/2000') > WIN32OLERuntimeError: focus > OLE error code:800A083E in htmlfile > Can't move focus to the control because it is invisible, not > enabled, or of a type that does not accept the focus. > HRESULT error code:0x80020009 > Exception occurred. > from > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1010/./watir.rb:3871:in > `method_missing' > from > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1010/./watir.rb:3871:in `set' > from (irb):15 > > In this case, a TR element a few levels higher has a style of > "visibility: hidden; display: none" so the control is invisible and thus > read only. > > I see a few solutions. The first would be to try to update the input > element and then rescue the WIN32OLERuntimeError exception. I'm not > particularly fond of this, especially since the exception isn't an > exception specific to this problem. Another option is to iterate up the > DOM elements checking every element to make sure that is is visible. > This could be done in > Element#readonly?, but then we wouldn't be able to see the value of the > actual readonly attribute. I chose to implement another method which I > called "writable?" which first checks that the element exists, is > enabled and not readonly and then moves up the DOM tree and reports > false if any element is not visible (visibility != 'hidden' and display > != 'none'). > > I've tested this and while it can be slow if the input element is deeply > embedded it *does* seem to be accurate: > > irb(main):016:0> ie.text_field(:id, 'Detail_Date').writable? > => false > irb(main):017:0> ie.text_field(:id, 'Detail_DOB').writable? > => true > > You can try this by adding the following method in your Watir script or > by adding just the writable? definition inside class Element in > Watir.rb. I can add this to trunk once I get some tests written to test > it if we decide this is the way to go. Does anyone have a cleaner or > faster way to do this? > > module Watir > class Element > # Determine if we can write to a DOM element. > # If any parent element isn't visible then we cannot write to the > # element. The only realiable way to determine this is to iterate > # up the DOM elemint tree checking every element to make sure it's > # visible. > def writable? > assert_exists > # First make sure the element itself is writable > begin > assert_enabled > assert_not_readonly > rescue Watir::Exception::ObjectDisabledException, > Watir::Exception::ObjectReadOnlyException > return false > end > return false if ! document.iscontentEditable > > # Now iterate up the DOM element tree and return false if any > # parent element isn't visible or is disabled. > object = document > while object > begin > if object.style.invoke('visibility') =~ /^hidden$/i > return false > end > if object.style.invoke('display') =~ /^none$/i > return false > end > if object.invoke('isDisabled') > return false > end > rescue WIN32OLERuntimeError > end > object += '.parentElement' > end > true > end > end > end > > > > > > ------------------------------ > > Message: 4 > Date: Thu, 1 Jun 2006 14:33:47 -0600 > From: "Tyler Prete" <[EMAIL PROTECTED]> > Subject: Re: [Wtr-general] Methods that can be used within a frame? > To: [email protected] > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8859-1" > > Bret, I think we are having some syntactic problems. I CAN do it manually, > by interacting with the page myself. I'll try and explain the situation > since I can't actually give an example. I am working with a customer > service app that has multiple frames, a search bar on the left, a customer > frame in the top right, and an invoice frame in the top left. When a search > is issued that can result in multiple people, a popup window is opened > containing all the names of possible customers. When a name is selected, > the customer frame is supposed to change to show that specific customer. > When I go through the process myself, it works. However, when using watir, > I can click on the link, but it does not load the customer info in the > customer frame. I could not get it to work directly, so my idea was to take > the link URL and load it manually in the frame, but apparently this is not > possible, at least not at this time. > > Hopefully that helps clear things up. > --Tyler > > On 6/1/06, Bret Pettichord <[EMAIL PROTECTED]> wrote: > > > > On 6/1/06, Tyler Prete <[EMAIL PROTECTED]> wrote: > > > > > Well I may not even have to deal with it anymore, but how would I change > > > this manually? I do not have control over the HTML in the page, I am > only > > > interacting with it via Watir. > > > > > > > By design, Watir is a tool for automating things that you can do manually. > > If you don't know how to do it manually, then Watir is probably the wrong > > tool for you. > > > > Bret > > > > > > _______________________________________________ > > Wtr-general mailing list > > [email protected] > > http://rubyforge.org/mailman/listinfo/wtr-general > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://rubyforge.org/pipermail/wtr-general/attachments/20060601/5e84241a/attachment-0001.htm > > ------------------------------ > > Message: 5 > Date: Thu, 1 Jun 2006 15:47:32 -0500 > From: "Bret Pettichord" <[EMAIL PROTECTED]> > Subject: Re: [Wtr-general] Methods that can be used within a frame? > To: [email protected] > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8859-1" > > On 6/1/06, Tyler Prete <[EMAIL PROTECTED]> wrote: > > > > When I go through the process myself, it works. However, when using > > watir, I can click on the link, but it does not load the customer info in > > the customer frame. > > > > This is the problem we should focus on. Can you provide more information? > Are you getting an error message? Can you show us any code or html? -- feel > free to sanitize. > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://rubyforge.org/pipermail/wtr-general/attachments/20060601/b5b64e09/attachment-0001.htm > > ------------------------------ > > Message: 6 > Date: Thu, 1 Jun 2006 16:05:38 -0600 > From: "Attebery, Bill" <[EMAIL PROTECTED]> > Subject: Re: [Wtr-general] How to create a script for calendar > function? > To: <[email protected]> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="us-ascii" > > > 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 > > End of Wtr-general Digest, Vol 31, Issue 5 > ****************************************** > _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
