From chaya_b_s at yahoo.co.in Mon Jan 2 00:46:57 2006 From: chaya_b_s at yahoo.co.in (chaya shetty) Date: Mon, 2 Jan 2006 05:46:57 +0000 (GMT) Subject: [Wtr-general] Is there way to find out the parent nodes and child nodes of a tree structure in watir? Message-ID: <20060102054657.59905.qmail@web8314.mail.in.yahoo.com> Hi, The application under test has got a tree structure. I want to write a test case which invovles navigating through the tree structure and verifying whether the correct screen is displayed when the corresponding link is clicked. I am able to navigate through the tree structure by using the link index.I am retrieving the innertext of the link and then verifying whether that text is present on the other frame. The code that I am using is link_index = 1 while(ie.frame(:index,tree_frame_index).link(:index,link_index).exists?) link_text = ie.frame(:index,tree_frame_index).link(:index,link_index).innerText ie.frame(:index,tree_frame_index).link(:index,link_index).click if $ie.frame(:index,text_frame_index).contains_text(link_text) puts "Test passed" else puts "Test failed" end link_index = link_index + 1 end Here the text of the child nodes are same for all the parent nodes. How do I know whether the text displayed of the child node belongs to the corresponding parent node? Is there way by which we can find out the parent nodes and child nodes of a tree structure in watir? Send instant messages to your online friends http://in.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060102/ff7d5cd5/attachment.html From amithashettyb at yahoo.co.in Mon Jan 2 00:55:51 2006 From: amithashettyb at yahoo.co.in (Amitha Shetty) Date: Mon, 2 Jan 2006 05:55:51 +0000 (GMT) Subject: [Wtr-general] How can I open and attach file using file_field method? Message-ID: <20060102055551.20258.qmail@web8510.mail.in.yahoo.com> Hi, How can I open and attach file using file_field method? when I try, ie.file_field(:id,'uploaded_file').set('C:\file.txt') I get "choose file"-window open .It waits for me, to choose a file and click "open" or whatever the button is called) , after that it continues normally, by submitting the file_field content. Why doesn't he choose a file by himself?How do I handle this? I have ensured that there is no space in the path and the file exists in C: ) I get the same error when I run filefield_test in Unittests in watir folder. Thanks, Amitha Send instant messages to your online friends http://in.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060102/5d9decee/attachment.html From Mark_Cain at rl.gov Tue Jan 3 13:53:22 2006 From: Mark_Cain at rl.gov (Cain, Mark) Date: Tue, 3 Jan 2006 10:53:22 -0800 Subject: [Wtr-general] How can I open and attach file using file_fieldmethod? Message-ID: <9C0BD1E3DAF1204D842D72E2DCE2A04ED1D4D8@EX5V.rl.gov> You could try something like-you will need to tweak it to work for your application: $path = "C\:\\watir_bonus\\working\\Approach.doc" $ie.frame(:index, 5).file_field(:id, "fileName").set("#{$path}") $autoit = WIN32OLE.new("AutoItX3.Control") $autoit.WinWait("Choose file", "Do you want to open or save this file?", 3) $autoit.WinActivate("Choose file") $autoit.WinWait("Choose file", "Look &in", 3) $autoit.ControlSetText("Choose file", "", "Edit1", "#{$path}") $autoit.ControlClick("Choose file", "Look &in", "&Open") $ie.frame(:index, 5).button(:name, "submitLinkManagerForm").click --Mark ________________________________ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Amitha Shetty Sent: Sunday, January 01, 2006 9:56 PM To: wtr-general at rubyforge.org Subject: [Wtr-general] How can I open and attach file using file_fieldmethod? Hi, How can I open and attach file using file_field method? when I try, ie.file_field(:id,'uploaded_file').set('C:\file.txt') I get "choose file"-window open .It waits for me, to choose a file and click "open" or whatever the button is called) , after that it continues normally, by submitting the file_field content. Why doesn't he choose a file by himself?How do I handle this? I have ensured that there is no space in the path and the file exists in C: ) I get the same error when I run filefield_test in Unittests in watir folder. Thanks, Amitha Send instant messages to your online friends http://in.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060103/4aa49f61/attachment.html From roy_sin at yahoo.com Tue Jan 3 20:42:34 2006 From: roy_sin at yahoo.com (Roy Sin) Date: Tue, 3 Jan 2006 17:42:34 -0800 (PST) Subject: [Wtr-general] my existing scripts give LoadError after I installed the latest tarball Message-ID: <20060104014234.8527.qmail@web52903.mail.yahoo.com> Hi Wtr, I used to have my watir installation in c:\Program files\watir. I downloaded the latest tarball because I want to use the xpath feature. I installed it under c:\watir. I can cd to unittests folder and run the sample rb files. But when I tried to run my existing scripts in eclipse I get the error below: C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__': No such file to load -- setup (LoadError) from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require' from C:/TestAutomation/workspace/QA_TestAutomation/gmmsunittests_Staging/logintoRP.rb:9 any idea! __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com From bret at pettichord.com Tue Jan 3 22:46:07 2006 From: bret at pettichord.com (Bret Pettichord) Date: Tue, 3 Jan 2006 21:46:07 -0600 Subject: [Wtr-general] my existing scripts give LoadError after I installed the latest tarball In-Reply-To: <20060104014234.8527.qmail@web52903.mail.yahoo.com> References: <20060104014234.8527.qmail@web52903.mail.yahoo.com> Message-ID: The problem is on line 9 of loginRP.rb. What code is on that line? On 1/3/06, Roy Sin wrote: > > Hi Wtr, > > I used to have my watir installation in c:\Program > files\watir. I downloaded the latest tarball because I want > to use the xpath feature. I installed it under c:\watir. I > can cd to unittests folder and run the sample rb files. But > when I tried to run my existing scripts in eclipse I get > the error below: > > > C:/Program > Files/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in > `require__': No such file to load -- setup (LoadError) > from C:/Program > Files/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in > `require' > from > > C:/TestAutomation/workspace/QA_TestAutomation/gmmsunittests_Staging/logintoRP.rb:9 > > > any idea! > > > > __________________________________________ > Yahoo! DSL ? Something to write home about. > Just $16.99/mo. or less. > dsl.yahoo.com > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060103/e9a0fd16/attachment.html From ChintakrindiMeghana at managementdynamics.com Wed Jan 4 08:45:11 2006 From: ChintakrindiMeghana at managementdynamics.com (Chintakrindi Meghanath ) Date: Wed, 4 Jan 2006 08:45:11 -0500 Subject: [Wtr-general] PDF Testing using the Watir Message-ID: Hi Can we test the PDF documents using the WATIR ? If yes, can anyone explain me how to do it. Thanks Meghanath Management Dynamics, Inc. ChintakrindiMeghana at ManagementDynamics.com Phone: 240.453.6507 Cell: 240.372.6241 www.ManagementDynamics.com The information contained in this e-mail message, including any attachments, constitutes proprietary and confidential information of Management Dynamics, Inc. and is intended only for the personal and confidential use of the recipient or recipients named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender immediately by e-mail and delete the original message. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060104/7827e527/attachment.html From Malcolm.Beaton at conchango.com Wed Jan 4 09:10:00 2006 From: Malcolm.Beaton at conchango.com (Beaton, Malcolm) Date: Wed, 4 Jan 2006 14:10:00 -0000 Subject: [Wtr-general] Keeping all global variable in a file Message-ID: Hi Ben I haven't tried Sathya Shankar's method but the one I use follows You can do this by placing them in a file and requiring it at the beginning of the script All my variables for a web site I'm testing are held in the file 'C:\RubyScripts\my\folder\setup' To load this when the script kicks off I place <> before the script body but after the <> line So the top of the script looks like this require 'watir' include Watir require 'C:\RubyScripts\my\folder\setup' # all set up Var for this script require 'C:\RubyScripts\my\folder\CustomMethods'# Custom Method Calls (You can also do this with custom methods that you will need in multiple scripts, that's what the last line is) The file 'C:\RubyScripts\my\folder\setup' is pretty much just a list of stuff like $myVar1 = A $myVar2 = 'Zebedee' $myArr1 = [1, 2, 3, 4, 5] Etc Hope this helps Malcolm Beaton Technical Consultant Conchango 'Innovative Change in Business' D +44 (0) 1784 222127 S +44 (0) 1784 222222 M +44 (0) 777 071 3121 malcolm.beaton at conchango.com http://www.conchango.com No.2 New Media Age - Top 10 Technology Agencies 2004 No.5 New Media Age - Top 20 Interactive Agencies 2004 No.3 Marketing - Top 100 New Media Agencies 2005 Winner - Best Travel Website - New Media Age 2005 Winner - Best Retail Website - British Interactive Media Association (BIMA) 2004 Winner - Information Management Business Intelligence Project of the Year 2003 Winner - Microsoft European Business Intelligence Solutions Award 2003 More awards > -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Torres, Ben (HQP) Sent: 30 December 2005 21:54 To: wtr-general at rubyforge.org Subject: [Wtr-general] Keeping all global variable in a file Hi, Can I keep all my global variables in a separate file from my script files and have several script files use these variables? If so, how? Thanks in advance, Ben _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _____________________________________________________________________ This e-mail has been scanned for viruses by MessageLabs. The information contained in this message is confidential and is intended for the addressee only. If you have received this message in error, please notify Conchango plc as soon as possible. The unauthorised use, disclosure, copying or alteration of this message is prohibited and may be unlawful. The internet cannot guarantee the integrity of this message and therefore Conchango plc will not be liable for the message if modified. Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784 222 222 F 44 (0) 1784 222 200 E talktous at conchango.com No. 2598884 From Malcolm.Beaton at conchango.com Wed Jan 4 12:15:04 2006 From: Malcolm.Beaton at conchango.com (Beaton, Malcolm) Date: Wed, 4 Jan 2006 17:15:04 -0000 Subject: [Wtr-general] selecting cells in Excell using activecell Message-ID: Maybe a little out of scope for this group but I am trying to write and retrieve cell data from Excel iteratively with ruby using the activecell property. Only problem is it does not seem to work. My script is basically require 'win32ole' application = WIN32OLE.new('Excel.Application') application.visible = TRUE workbook = application.Workbooks.Add(); worksheet = workbook.Worksheets(1); (1..4).each do |x| dirArray = ['North','South','East','West'] worksheet.Range('A' + (x.to_s)).value = dirArray[(x-1)] end sheet = application.activesheet sheet.activecell.offset(1,0).activate and I always get the error excell.rb:47:in `method_missing': Unknown property or method `activecell' (WIN32OLERuntimeError) Am I missing a lib or something? I can find no reference to other people having this issue Any help would be appreciated Malcolm Beaton _____________________________________________________________________ This e-mail has been scanned for viruses by MessageLabs. The information contained in this message is confidential and is intended for the addressee only. If you have received this message in error, please notify Conchango plc as soon as possible. The unauthorised use, disclosure, copying or alteration of this message is prohibited and may be unlawful. The internet cannot guarantee the integrity of this message and therefore Conchango plc will not be liable for the message if modified. Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784 222 222 F 44 (0) 1784 222 200 E talktous at conchango.com No. 2598884 From Mark_Cain at rl.gov Wed Jan 4 13:04:52 2006 From: Mark_Cain at rl.gov (Cain, Mark) Date: Wed, 4 Jan 2006 10:04:52 -0800 Subject: [Wtr-general] selecting cells in Excell using activecell Message-ID: <9C0BD1E3DAF1204D842D72E2DCE2A04ED1D4DE@EX5V.rl.gov> This you might find helpful http://rubygarden.org/ruby?ScriptingExcel Also, I was playing around with your script and this worked for me: sheet = application sheet.activecell.offset(1,0).activate --Mark -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Beaton, Malcolm Sent: Wednesday, January 04, 2006 9:15 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] selecting cells in Excell using activecell Maybe a little out of scope for this group but I am trying to write and retrieve cell data from Excel iteratively with ruby using the activecell property. Only problem is it does not seem to work. My script is basically require 'win32ole' application = WIN32OLE.new('Excel.Application') application.visible = TRUE workbook = application.Workbooks.Add(); worksheet = workbook.Worksheets(1); (1..4).each do |x| dirArray = ['North','South','East','West'] worksheet.Range('A' + (x.to_s)).value = dirArray[(x-1)] end sheet = application.activesheet sheet.activecell.offset(1,0).activate and I always get the error excell.rb:47:in `method_missing': Unknown property or method `activecell' (WIN32OLERuntimeError) Am I missing a lib or something? I can find no reference to other people having this issue Any help would be appreciated Malcolm Beaton _____________________________________________________________________ This e-mail has been scanned for viruses by MessageLabs. The information contained in this message is confidential and is intended for the addressee only. If you have received this message in error, please notify Conchango plc as soon as possible. The unauthorised use, disclosure, copying or alteration of this message is prohibited and may be unlawful. The internet cannot guarantee the integrity of this message and therefore Conchango plc will not be liable for the message if modified. Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784 222 222 F 44 (0) 1784 222 200 E talktous at conchango.com No. 2598884 _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From roy_sin at yahoo.com Wed Jan 4 13:06:54 2006 From: roy_sin at yahoo.com (Roy Sin) Date: Wed, 4 Jan 2006 10:06:54 -0800 (PST) Subject: [Wtr-general] my existing scripts give LoadError after I installed the latest tarball In-Reply-To: Message-ID: <20060104180654.37452.qmail@web52912.mail.yahoo.com> My mistake, has nothing to do with my new installation of Watir. On line 9 was to require 'setup' which was in the same directory but I just reorganized my scripts by component/module and didn't copy the setup.rb thanks --- Bret Pettichord wrote: > The problem is on line 9 of loginRP.rb. > > What code is on that line? > > On 1/3/06, Roy Sin wrote: > > > > Hi Wtr, > > > > I used to have my watir installation in c:\Program > > files\watir. I downloaded the latest tarball because I > want > > to use the xpath feature. I installed it under > c:\watir. I > > can cd to unittests folder and run the sample rb files. > But > > when I tried to run my existing scripts in eclipse I > get > > the error below: > > > > > > C:/Program > > > Files/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in > > `require__': No such file to load -- setup (LoadError) > > from C:/Program > > > Files/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in > > `require' > > from > > > > > C:/TestAutomation/workspace/QA_TestAutomation/gmmsunittests_Staging/logintoRP.rb:9 > > > > > > any idea! > > > > > > > > __________________________________________ > > Yahoo! DSL ??? Something to write home about. > > Just $16.99/mo. or less. > > dsl.yahoo.com > > > > _______________________________________________ > > Wtr-general mailing list > > Wtr-general at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wtr-general > > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com From Malcolm.Beaton at conchango.com Wed Jan 4 16:27:07 2006 From: Malcolm.Beaton at conchango.com (Beaton, Malcolm) Date: Wed, 4 Jan 2006 21:27:07 -0000 Subject: [Wtr-general] selecting cells in Excell using activecell Message-ID: THANK YOU MARK Works a treat Now excuse my ignorance but why does <> work but <> not work? My experience with Applescript suggests I was in the wrong object but the ruby objects still confuse me a little Malcolm Beaton -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Cain, Mark Sent: 04 January 2006 18:05 To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] selecting cells in Excell using activecell This you might find helpful http://rubygarden.org/ruby?ScriptingExcel Also, I was playing around with your script and this worked for me: sheet = application sheet.activecell.offset(1,0).activate --Mark -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Beaton, Malcolm Sent: Wednesday, January 04, 2006 9:15 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] selecting cells in Excell using activecell Maybe a little out of scope for this group but I am trying to write and retrieve cell data from Excel iteratively with ruby using the activecell property. Only problem is it does not seem to work. My script is basically require 'win32ole' application = WIN32OLE.new('Excel.Application') application.visible = TRUE workbook = application.Workbooks.Add(); worksheet = workbook.Worksheets(1); (1..4).each do |x| dirArray = ['North','South','East','West'] worksheet.Range('A' + (x.to_s)).value = dirArray[(x-1)] end sheet = application.activesheet sheet.activecell.offset(1,0).activate and I always get the error excell.rb:47:in `method_missing': Unknown property or method `activecell' (WIN32OLERuntimeError) Am I missing a lib or something? I can find no reference to other people having this issue Any help would be appreciated Malcolm Beaton _____________________________________________________________________ This e-mail has been scanned for viruses by MessageLabs. The information contained in this message is confidential and is intended for the addressee only. If you have received this message in error, please notify Conchango plc as soon as possible. The unauthorised use, disclosure, copying or alteration of this message is prohibited and may be unlawful. The internet cannot guarantee the integrity of this message and therefore Conchango plc will not be liable for the message if modified. Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784 222 222 F 44 (0) 1784 222 200 E talktous at conchango.com No. 2598884 _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _____________________________________________________________________ This e-mail has been scanned for viruses by MessageLabs. The information contained in this message is confidential and is intended for the addressee only. If you have received this message in error, please notify Conchango plc as soon as possible. The unauthorised use, disclosure, copying or alteration of this message is prohibited and may be unlawful. The internet cannot guarantee the integrity of this message and therefore Conchango plc will not be liable for the message if modified. Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784 222 222 F 44 (0) 1784 222 200 E talktous at conchango.com No. 2598884 From David.J.Solis at wellsfargo.com Wed Jan 4 16:42:29 2006 From: David.J.Solis at wellsfargo.com (David.J.Solis at wellsfargo.com) Date: Wed, 4 Jan 2006 15:42:29 -0600 Subject: [Wtr-general] Navigating in JavaScript popup Message-ID: <493148DCF171954FBBF8E8AAB261638C0574CC@msgswbmnmsp35.wellsfargo.com> I have a java calendar in my web app that when selecting a date from the calendar pre-fills a text box. The text box is read only. I can't write to the text box because of the read only restriction so I'm forced to have to click on a button to invoke the calendar and select a date. When a date is clicked on the calendar, the text box populates and the calendar closes automatically. Any ideas on how to navigate and select objects in the popup? Here is a snippet of the code I'm automating. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060104/92de54f6/attachment.html From roy_sin at yahoo.com Wed Jan 4 17:29:50 2006 From: roy_sin at yahoo.com (Roy Sin) Date: Wed, 4 Jan 2006 14:29:50 -0800 (PST) Subject: [Wtr-general] assert_match question Message-ID: <20060104222950.37435.qmail@web52906.mail.yahoo.com> Hi Wtr, I have a begin end as shown below where I do an assert_match to see if the html match a string variable that I stored as greenStopTime = '12:26PM to 12:29PM' -------- begin assert_match(greenStopTime, $ie.frame("cpmain").html.to_s) puts("4 min Stop duration TEST PASSED\n") rescue => e puts("TEST FAILED Didn't find the 4 min stop. " + e.message + "\n") end -------- TEST FAILED Didn't find the 4 min stop. undefined method `html' for # I'm getting an undefined method for html. I believe i require all the files i need. Any idea! thks __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com From bret at pettichord.com Wed Jan 4 19:40:52 2006 From: bret at pettichord.com (Bret Pettichord) Date: Wed, 4 Jan 2006 18:40:52 -0600 Subject: [Wtr-general] Navigating in JavaScript popup In-Reply-To: <493148DCF171954FBBF8E8AAB261638C0574CC@msgswbmnmsp35.wellsfargo.com> References: <493148DCF171954FBBF8E8AAB261638C0574CC@msgswbmnmsp35.wellsfargo.com> Message-ID: Can you directly change its value? Thus: ie.text(:id, "barportlet{actionForm.assetDoWrittenApproval}").value = "1/1/06" Bret On 1/4/06, David.J.Solis at wellsfargo.com wrote: > > I have a java calendar in my web app that when selecting a date from the > calendar pre-fills a text box. The text box is read only. I can't write to > the text box because of the read only restriction so I'm forced to have to > click on a button to invoke the calendar and select a date. When a date is > clicked on the calendar, the text box populates and the calendar closes > automatically. Any ideas on how to navigate and select objects in the popup? > Here is a snippet of the code I'm automating. > > ="barportlet{actionForm.assetDoWrittenApproval}" value="" readonly> > onmouseover="this.className='tbBtnItemOverCalendar'" onmouseout=" > this.className='tbBtnItemOffCalendar'" onClick= > "calendar_popup('assetDoWrittenApproval')"> > > > > > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060104/b87dda14/attachment.html From zeljko.filipin at gmail.com Thu Jan 5 03:30:33 2006 From: zeljko.filipin at gmail.com (Zeljko Filipin) Date: Thu, 5 Jan 2006 09:30:33 +0100 Subject: [Wtr-general] assert_match question In-Reply-To: <20060104222950.37435.qmail@web52906.mail.yahoo.com> References: <20060104222950.37435.qmail@web52906.mail.yahoo.com> Message-ID: I think that your error message "undefined method `html' for Frame" means that "html" method is not defined for Frame class. Zeljko 2006/1/4, Roy Sin :> Hi Wtr,> I have a begin end as shown below where I do an> assert_match to see if the html match a string variable> that I stored as> greenStopTime = '12:26PM to 12:29PM'> --------> begin> assert_match(greenStopTime,> $ie.frame("cpmain").html.to_s)> puts("4 min Stop duration TEST PASSED\n")> rescue => e> puts("TEST FAILED Didn't find the 4 min stop. " +> e.message + "\n")> end> --------> TEST FAILED Didn't find the 4 min stop. undefined method> `html' for #>> I'm getting an undefined method for html. I believe i> require all the files i need. Any idea!>> thks>>>> __________________________________________> Yahoo! DSL ? Something to write home about.> Just $16.99/mo. or less.> dsl.yahoo.com>> _______________________________________________> Wtr-general mailing list> Wtr-general at rubyforge.org> http://rubyforge.org/mailman/listinfo/wtr-general> From ChintakrindiMeghana at managementdynamics.com Thu Jan 5 06:56:18 2006 From: ChintakrindiMeghana at managementdynamics.com (Chintakrindi Meghanath ) Date: Thu, 5 Jan 2006 06:56:18 -0500 Subject: [Wtr-general] PDF Testing using the Watir Message-ID: Hi All Yesterday I posted a request reagarding the PDF testing using Watir. But still so far there are no responses for this thread. Once again I am asking , is it possible to use Watir for testing the PDF documents. Thanks Meghanath -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org]On Behalf Of Chintakrindi Meghanath Sent: Wednesday, January 04, 2006 8:45 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] PDF Testing using the Watir Hi Can we test the PDF documents using the WATIR ? If yes, can anyone explain me how to do it. Thanks Meghanath Management Dynamics, Inc. ChintakrindiMeghana at ManagementDynamics.com Phone: 240.453.6507 Cell: 240.372.6241 www.ManagementDynamics.com The information contained in this e-mail message, including any attachments, constitutes proprietary and confidential information of Management Dynamics, Inc. and is intended only for the personal and confidential use of the recipient or recipients named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender immediately by e-mail and delete the original message. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060105/8e23544f/attachment.html From zeljko.filipin at gmail.com Thu Jan 5 07:08:58 2006 From: zeljko.filipin at gmail.com (Zeljko Filipin) Date: Thu, 5 Jan 2006 13:08:58 +0100 Subject: [Wtr-general] PDF Testing using the Watir In-Reply-To: Message-ID: <003301c611f0$cf88f380$c6e7fea9@officezg.wa> As far as I know, no. But maybe you can test pdf files using some other ruby library. Zeljko _____ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Chintakrindi Meghanath Sent: Thursday, January 05, 2006 12:56 PM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] PDF Testing using the Watir Hi All Yesterday I posted a request reagarding the PDF testing using Watir. But still so far there are no responses for this thread. Once again I am asking , is it possible to use Watir for testing the PDF documents. Thanks Meghanath -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org]On Behalf Of Chintakrindi Meghanath Sent: Wednesday, January 04, 2006 8:45 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] PDF Testing using the Watir Hi Can we test the PDF documents using the WATIR ? If yes, can anyone explain me how to do it. Thanks Meghanath Management Dynamics, Inc. ChintakrindiMeghana at ManagementDynamics.com Phone: 240.453.6507 Cell: 240.372.6241 www.ManagementDynamics.com The information contained in this e-mail message, including any attachments, constitutes proprietary and confidential information of Management Dynamics, Inc. and is intended only for the personal and confidential use of the recipient or recipients named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender immediately by e-mail and delete the original message. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060105/71aebba5/attachment.html From chaya_b_s at yahoo.co.in Thu Jan 5 07:45:27 2006 From: chaya_b_s at yahoo.co.in (chaya shetty) Date: Thu, 5 Jan 2006 12:45:27 +0000 (GMT) Subject: [Wtr-general] How can I open and attach file using file_field method? In-Reply-To: <20060102055551.20258.qmail@web8510.mail.in.yahoo.com> Message-ID: <20060105124527.32510.qmail@web8321.mail.in.yahoo.com> Hi, I tried with path = "C\:Watir\Text.doc" ie.file_field(:value,'Value').set(#{path}) $autoit = WIN32OLE.new("AutoItX3.Control") $autoit.WinActivate("Choose file") $autoit.ControlSetText("Choose file", "", "Edit1", "#{path}") $autoit.ControlClick("Choose file", "Look &in", "&Open") $ie.button(:name, "Submit").click But the same behaviour persists. i.e. the "Choose File" window opens and waits till you manually select the file. Can't ie.file_field(:value,'Value').set(#{path}) automatically set the path? Thanks Chaya --Mark Amitha Shetty wrote: Hi, How can I open and attach file using file_field method? when I try, ie.file_field(:id,'uploaded_file').set('C:\file.txt') I get "choose file"-window open .It waits for me, to choose a file and click "open" or whatever the button is called) , after that it continues normally, by submitting the file_field content. Why doesn't he choose a file by himself?How do I handle this? I have ensured that there is no space in the path and the file exists in C: ) I get the same error when I run filefield_test in Unittests in watir folder. Thanks, Amitha Send instant messages to your online friends http://in.messenger.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general Send instant messages to your online friends http://in.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060105/9e7bc5d0/attachment.html From Mark_Cain at rl.gov Thu Jan 5 10:24:50 2006 From: Mark_Cain at rl.gov (Cain, Mark) Date: Thu, 5 Jan 2006 07:24:50 -0800 Subject: [Wtr-general] How can I open and attach file using file_fieldmethod? Message-ID: <9C0BD1E3DAF1204D842D72E2DCE2A04ED1D4E5@EX5V.rl.gov> Yes, the problem is (:value, 'Value') in this line: ie.file_field(:value,'Value').set(#{path}) The file_field supports these attributes: :id, :name, :index. Do a view source and find out what the attribute values for your tag. If for some reason your developers were lazy and didn't give the tag an id or name attribute, use index. If there are more than one tag on the page the indexing starts top-most down with 1 and increments from there. Here is the usage portion for file_field from Watir.rb: # This is the main method for accessing a file field. Usually an HTML tag. # * how - symbol - how we access the field , :index, :id, :name etc # * what - string, int or re , what we are looking for, # # returns a FileField object # # Typical Usage # # ie.file_field(:id, 'up_1') # access the file upload field with an ID of up_1 # ie.file_field(:name, 'upload') # access the file upload field with a name of upload # ie.file_field(:index, 2) # access the second file upload on the page ( 1 based, so the first field is accessed with :index,1) Hope this helps, --Mark ________________________________ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of chaya shetty Sent: Thursday, January 05, 2006 4:45 AM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] How can I open and attach file using file_fieldmethod? Hi, I tried with path = "C\:Watir\Text.doc" ie.file_field(:value,'Value').set(#{path}) $autoit = WIN32OLE.new("AutoItX3.Control") $autoit.WinActivate("Choose file") $autoit.ControlSetText("Choose file", "", "Edit1", "#{path}") $autoit.ControlClick("Choose file", "Look &in", "&Open") $ie.button(:name, "Submit").click But the same behaviour persists. i.e. the "Choose File" window opens and waits till you manually select the file. Can't ie.file_field(:value,'Value').set(#{path}) automatically set the path? Thanks Chaya --Mark Amitha Shetty wrote: Hi, How can I open and attach file using file_field method? when I try, ie.file_field(:id,'uploaded_file').set('C:\file.txt') I get "choose file"-window open .It waits for me, to choose a file and click "open" or whatever the button is called) , after that it continues normally, by submitting the file_field content. Why doesn't he choose a file by himself?How do I handle this? I have ensured that there is no space in the path and the file exists in C: ) I get the same error when I run filefield_test in Unittests in watir folder. Thanks, Amitha Send instant messages to your online friends http://in.messenger.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general Send instant messages to your online friends http://in.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060105/a73ca67f/attachment.html From Carol.Haney at zsassociates.com Thu Jan 5 12:27:40 2006 From: Carol.Haney at zsassociates.com (Carol.Haney at zsassociates.com) Date: Thu, 5 Jan 2006 11:27:40 -0600 Subject: [Wtr-general] CN=Carol Haney/OU=SD/O=ZSAssociates is out of the office. Message-ID: I will be out of the office starting 01/05/2006 and will not return until 01/06/2006. I am out of the office today but checking email. From jon at pdxfishguy.com Thu Jan 5 18:20:49 2006 From: jon at pdxfishguy.com (Jon Passmore) Date: Thu, 5 Jan 2006 18:20:49 -0500 Subject: [Wtr-general] Newbie - How to get value found by searching for regular expression? Message-ID: I can verify that a value exists that matches a regular expression, but how can I return that value? example: I add a record and it returns a page with a dynamically generated ID. The value does not have any tags that will help me locate it so I have to search using a regular expression. pageContainsText(/[0-9]{8}-[0-9]/) This works great, but what do I do if I want to return that value and assign it to a variable? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060105/dacc8441/attachment.html From roy_sin at yahoo.com Thu Jan 5 19:20:27 2006 From: roy_sin at yahoo.com (Roy Sin) Date: Thu, 5 Jan 2006 16:20:27 -0800 (PST) Subject: [Wtr-general] assert_match question In-Reply-To: Message-ID: <20060106002027.30930.qmail@web52902.mail.yahoo.com> I uninstalled the latest tarball and installed Watir again from the one-click installer and ran my scripts. I didn't get the undefined method 'html' error and my scripts completed sucessfully. --- Zeljko Filipin wrote: > I think that your error message > "undefined method `html' for Frame" > means that "html" method is not defined for Frame class. > Zeljko > 2006/1/4, Roy Sin :> Hi Wtr,> I have a > begin end as shown below where I do an> assert_match to > see if the html match a string variable> that I stored > as> greenStopTime = '12:26PM to 12:29PM'> --------> > begin> assert_match(greenStopTime,> > $ie.frame("cpmain").html.to_s)> puts("4 min Stop > duration TEST PASSED\n")> rescue => e> > puts("TEST FAILED Didn't find the 4 min stop. " +> > e.message + "\n")> end> --------> TEST FAILED Didn't find > the 4 min stop. undefined method> `html' for > #>> I'm getting an undefined > method for html. I believe i> require all the files i > need. Any idea!>> thks>>>> > __________________________________________> Yahoo! DSL ??? > Something to write home about.> Just $16.99/mo. or less.> > dsl.yahoo.com>> > _______________________________________________> > Wtr-general mailing list> Wtr-general at rubyforge.org> > http://rubyforge.org/mailman/listinfo/wtr-general> > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com From roy_sin at yahoo.com Thu Jan 5 19:21:09 2006 From: roy_sin at yahoo.com (Roy Sin) Date: Thu, 5 Jan 2006 16:21:09 -0800 (PST) Subject: [Wtr-general] assert_match question In-Reply-To: Message-ID: <20060106002109.77877.qmail@web52908.mail.yahoo.com> I uninstalled the latest tarball and installed Watir again from the one-click installer and ran my scripts. I didn't get the undefined method 'html' error and my scripts completed sucessfully. --- Zeljko Filipin wrote: > I think that your error message > "undefined method `html' for Frame" > means that "html" method is not defined for Frame class. > Zeljko > 2006/1/4, Roy Sin :> Hi Wtr,> I have a > begin end as shown below where I do an> assert_match to > see if the html match a string variable> that I stored > as> greenStopTime = '12:26PM to 12:29PM'> --------> > begin> assert_match(greenStopTime,> > $ie.frame("cpmain").html.to_s)> puts("4 min Stop > duration TEST PASSED\n")> rescue => e> > puts("TEST FAILED Didn't find the 4 min stop. " +> > e.message + "\n")> end> --------> TEST FAILED Didn't find > the 4 min stop. undefined method> `html' for > #>> I'm getting an undefined > method for html. I believe i> require all the files i > need. Any idea!>> thks>>>> > __________________________________________> Yahoo! DSL ??? > Something to write home about.> Just $16.99/mo. or less.> > dsl.yahoo.com>> > _______________________________________________> > Wtr-general mailing list> Wtr-general at rubyforge.org> > http://rubyforge.org/mailman/listinfo/wtr-general> > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com From roy_sin at yahoo.com Thu Jan 5 20:45:25 2006 From: roy_sin at yahoo.com (Roy Sin) Date: Thu, 5 Jan 2006 17:45:25 -0800 (PST) Subject: [Wtr-general] interesting behavior of require in my TestSuite to run test cases in a sequential order... Message-ID: <20060106014526.67677.qmail@web52910.mail.yahoo.com> Hi Wtr, I have a few classes, each class is a test case for a Report and I'm trying to run them all together in a TestSuite. Here is my reports_testsuite.rb : require 'login' # run Test Cases in the order listed below require 'stopRpt_test' require 'landmarkSumRpt_test' require 'mileageSumRpt_test' ... But when i ran it, landmarkSumRpt runs first follow by mileageSumRpt , then the last one is StopRpt. I even tried to prefix with 'test1_stopRpt_test' 'test2_landmarkSumRpt_test' 'test3_mileageSumRpt_test' but still test1_stopRpt_test will run last. I also puts a text at the beginning of each of my test cases to know when each one starts but instead I get: Stop Report Test Case running... Landmark Summary Test Case running... Mileage Summary Test Case running... Loaded suite C:/TestAutomation/workspace/QA_TestAutomation/gmmsunittests_Staging/reports/reports_testsuite1 Started Has anyone experience this type of situation? thanks __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com From chaya_b_s at yahoo.co.in Fri Jan 6 00:26:51 2006 From: chaya_b_s at yahoo.co.in (chaya shetty) Date: Fri, 6 Jan 2006 05:26:51 +0000 (GMT) Subject: [Wtr-general] How can I open and attach file using file_fieldmethod? In-Reply-To: <9C0BD1E3DAF1204D842D72E2DCE2A04ED1D4E5@EX5V.rl.gov> Message-ID: <20060106052651.76204.qmail@web8323.mail.in.yahoo.com> Hi, There is only one file field in the page and hence I tried with path = "C\:Watir\Text.doc" ie.file_field(:index,1).set(#{path}) $autoit = WIN32OLE.new("AutoItX3.Control") $autoit.WinActivate("Choose file") $autoit.ControlSetText("Choose file", "", "Edit1", "#{path}") $autoit.ControlClick("Choose file", "Look &in", "&Open") $ie.button(:name, "Submit").click But still the same behaviour was seen. The file field was accessed and the "Choose File" window opened and waited till I manually selected the file. Thanks Chaya "Cain, Mark" wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } Yes, the problem is (:value, ?Value?) in this line: ie.file_field(:value,'Value').set(#{path}) The file_field supports these attributes: :id, :name, :index. Do a view source and find out what the attribute values for your tag. If for some reason your developers were lazy and didn?t give the tag an id or name attribute, use index. If there are more than one tag on the page the indexing starts top-most down with 1 and increments from there. Here is the usage portion for file_field from Watir.rb: # This is the main method for accessing a file field. Usually an HTML tag. # * how - symbol - how we access the field , :index, :id, :name etc # * what - string, int or re , what we are looking for, # # returns a FileField object # # Typical Usage # # ie.file_field(:id, 'up_1') # access the file upload field with an ID of up_1 # ie.file_field(:name, 'upload') # access the file upload field with a name of upload # ie.file_field(:index, 2) # access the second file upload on the page ( 1 based, so the first field is accessed with :index,1) Hope this helps, --Mark --------------------------------- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of chaya shetty Sent: Thursday, January 05, 2006 4:45 AM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] How can I open and attach file using file_fieldmethod? Hi, I tried with path = "C\:Watir\Text.doc" ie.file_field(:value,'Value').set(#{path}) $autoit = WIN32OLE.new("AutoItX3.Control") $autoit.WinActivate("Choose file") $autoit.ControlSetText("Choose file", "", "Edit1", "#{path}") $autoit.ControlClick("Choose file", "Look &in", "&Open") $ie.button(:name, "Submit").click But the same behaviour persists. i.e. the "Choose File" window opens and waits till you manually select the file. Can't ie.file_field(:value,'Value').set(#{path}) automatically set the path? Thanks Chaya --Mark Amitha Shetty wrote: Hi, How can I open and attach file using file_field method? when I try, ie.file_field(:id,'uploaded_file').set('C:\file.txt') I get "choose file"-window open .It waits for me, to choose a file and click "open" or whatever the button is called) , after that it continues normally, by submitting the file_field content. Why doesn't he choose a file by himself?How do I handle this? I have ensured that there is no space in the path and the file exists in C: ) I get the same error when I run filefield_test in Unittests in watir folder. Thanks, Amitha Send instant messages to your online friends http://in.messenger.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general Send instant messages to your online friends http://in.messenger.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general Send instant messages to your online friends http://in.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060106/85401572/attachment.html From shilpa_sainani at yahoo.com Fri Jan 6 05:15:40 2006 From: shilpa_sainani at yahoo.com (Shilpa Sainani) Date: Fri, 6 Jan 2006 02:15:40 -0800 (PST) Subject: [Wtr-general] Javascript alert/confirm Message-ID: <20060106101540.16699.qmail@web51304.mail.yahoo.com> Hi, I am new to watir and its a great tool:). I need help. I am trying to use it to autoamte my web application and there are a lot of javascript alerts/confirms in the application. I have run the autoIT unittests and they run successfully. HOwever, I do not know how to make my testscript click OK on a javasscript alert which is triggered as part of the workflow. Any ideas? Thanks! __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com From Mark_Cain at rl.gov Fri Jan 6 10:01:31 2006 From: Mark_Cain at rl.gov (Cain, Mark) Date: Fri, 6 Jan 2006 07:01:31 -0800 Subject: [Wtr-general] How can I open and attach file usingfile_fieldmethod? Message-ID: <9C0BD1E3DAF1204D842D72E2DCE2A04ED1D4EE@EX5V.rl.gov> Replace all your $autoit lines with this: $autoit = WIN32OLE.new("AutoItX3.Control") $autoit.WinWait("Choose file", "Do you want to open or save this file?", 3) $autoit.WinActivate("Choose file") $autoit.WinWait("Choose file", "Look &in", 3) $autoit.ControlSetText("Choose file", "", "Edit1", "#{$path}") $autoit.ControlClick("Choose file", "Look &in", "&Open") I don't know if it will make a difference but my script needed the WinWait's left in to work right. Also, it took a little time for autoit to find the window so don't get impatient. Hope this helps, --Mark ________________________________ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of chaya shetty Sent: Thursday, January 05, 2006 9:27 PM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] How can I open and attach file usingfile_fieldmethod? Hi, There is only one file field in the page and hence I tried with path = "C\:Watir\Text.doc" ie.file_field(:index,1).set(#{path}) $autoit = WIN32OLE.new("AutoItX3.Control") $autoit.WinActivate("Choose file") $autoit.ControlSetText("Choose file", "", "Edit1", "#{path}") $autoit.ControlClick("Choose file", "Look &in", "&Open") $ie.button(:name, "Submit").click But still the same behaviour was seen. The file field was accessed and the "Choose File" window opened and waited till I manually selected the file. Thanks Chaya "Cain, Mark" wrote: Yes, the problem is (:value, 'Value') in this line: ie.file_field(:value,'Value').set(#{path}) ! The file_field supports these attributes: :id, :name, :index. Do a view source and find out what the attribute values for your tag. If for some reason your developers were lazy and didn't give the tag an id or name attribute, use index. If there are more than one tag on the page the indexing starts top-most down with 1 and increments from there. Here is the usage portion for file_field from Watir.rb: # This is the main me! thod for accessing a file field. Usually an HTML tag. # * how - symbol - how we access the field , :index, :id, :name etc # * what - string, int or re , what we are looking for, # # returns a FileField object # # Typical Usage # # ie.file_field(:id, 'up_1') # access the file upload field with an ID of up_1 # ie.file_field(:name, 'upload') # access the file upload field with a name of upload # ie.file_field(:index, 2) # access the second file upload on the page ( 1 based, so the first field is accessed with :index,1) Hope this helps, --Mark ________________________________ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of chaya shetty Sent: Thursday, January 05, 2006 4:45 AM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] How can I open and attach file using file_fieldmethod? Hi, I tried with path = "C\:Watir\Text.doc" ie.file_field(:value,'Value').set(#{path}) $autoit = WIN32OLE.new("AutoItX3.Control") $autoit.WinActivate("Choose file") $autoit.ControlSetText("Choose file", "", "Edit1", "#{path}") $autoit.ControlClick("Choose file", "Look &in", "&Open") $ie.button(:name, "Submit").click But the same behaviour persists. i.e. the "Choose File" window opens and waits till you manually select the file. Can't ie.file_field(:value,'Value').set(#{path}) automatically set the path? Thanks Chaya --Mark Amitha Shetty wrote: Hi, How can I open and attach file using file_field method? when I try, ie.file_field(:id,'uploaded_file').set('C:\file.txt') I get "choose file"-window open .It waits for me, to choose a file and click "open" or whatever the button is called) , after that it continues normally, by submitting the file_field content. Why doesn't he choose a file by himself?How do I handle this? I have ensured that there is no space in the path and the file exists in C: ) I get the same error when I run filefield_test in Unittests in watir folder. Thanks, Amitha Send instant messages to your online friends http://in.messenger.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general Send instant messages to your online friends http://in.messenger.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general Send instant messages to your online friends http://in.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060106/fada3fd3/attachment.html From Mark_Cain at rl.gov Fri Jan 6 10:08:46 2006 From: Mark_Cain at rl.gov (Cain, Mark) Date: Fri, 6 Jan 2006 07:08:46 -0800 Subject: [Wtr-general] Javascript alert/confirm Message-ID: <9C0BD1E3DAF1204D842D72E2DCE2A04ED1D4EF@EX5V.rl.gov> This has worked pretty well for me. #Put this method in your script: def startClicker( button , waitTime = 3) w = WinClicker.new longName = $ie.dir.gsub("/" , "\\" ) shortName = w.getShortFileName(longName) c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button } #{ waitTime} " puts "Starting #{c}" w.winsystem(c) w=nil end #Then call it right before you click the button (or whatever) that causes the javascript popup to display: startClicker("OK" , 3) $ie.button("Submit").click You can look at the unittest that come with the Watir package for more good examples. Hope this helps, --Mark -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Shilpa Sainani Sent: Friday, January 06, 2006 2:16 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] Javascript alert/confirm Hi, I am new to watir and its a great tool:). I need help. I am trying to use it to autoamte my web application and there are a lot of javascript alerts/confirms in the application. I have run the autoIT unittests and they run successfully. HOwever, I do not know how to make my testscript click OK on a javasscript alert which is triggered as part of the workflow. Any ideas? Thanks! __________________________________________ Yahoo! DSL - Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From ardhazes at yahoo.com Sat Jan 7 14:21:05 2006 From: ardhazes at yahoo.com (e aldaz) Date: Sat, 7 Jan 2006 19:21:05 +0000 (GMT) Subject: [Wtr-general] Watir and Java Script onClick difficulties Message-ID: <20060107192105.78113.qmail@web51811.mail.yahoo.com> Dear All I am quite new to Ruby and Watir (but have bought and read the famous PickAke). I have had quite a lot of success using Watir on normal HTML pages, however i am having all sorts of trouble with some java script. I was wondering if someone could: 1.- Tell me where to find documentation on using watir with pages that have javascript 2.- Help me with this particular example, i need to click on a button called entrar, that appears as an image in "http://www.gruposantander.es" under "Supernet acceso particulares" From what i gather if i need to click on a button or image or link that starts some java script i need to do something like: ie.button(...).fire_event("onClick") or ie.image(...)..fire_event("onClick") etc.. However i have not been able to get the onClick that appears on the following HTML table (frow view source of the page) to fire, Transmisión segura de sus datos
personales, SSL 128 bits   Any ideas how to do it? I have tried $ie.link(:url, "#").fire_event("onClick") but I get irb(main):029:0> ie.link(:url,"#").fire_event("onClick") Watir::Exception::UnknownObjectException: Unable to locate object, using url and # I've also tried beforeText, afterText,etc.. but can't seem to get it to work Using index i can activate other links, but not this particular one Any help much appreciated ! Thanks Eduardo From mb at michaelbolton.net Sat Jan 7 15:12:36 2006 From: mb at michaelbolton.net (Michael Bolton) Date: Sat, 7 Jan 2006 15:12:36 -0500 Subject: [Wtr-general] interesting behavior of require in my TestSuite torun test cases in a sequential order... Message-ID: <000b01c613c6$b3ad01b0$6801a8c0@Koko> Looks to me like they're running in alphabetical order. But why are you using /require/ instead of calling them? ---Michael B. -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Roy Sin Sent: January 5, 2006 8:45 PM To: wtr-general at rubyforge.org Subject: [Wtr-general] interesting behavior of require in my TestSuite torun test cases in a sequential order... Hi Wtr, I have a few classes, each class is a test case for a Report and I'm trying to run them all together in a TestSuite. Here is my reports_testsuite.rb : require 'login' # run Test Cases in the order listed below require 'stopRpt_test' require 'landmarkSumRpt_test' require 'mileageSumRpt_test' ... But when i ran it, landmarkSumRpt runs first follow by mileageSumRpt , then the last one is StopRpt. I even tried to prefix with 'test1_stopRpt_test' 'test2_landmarkSumRpt_test' 'test3_mileageSumRpt_test' but still test1_stopRpt_test will run last. I also puts a text at the beginning of each of my test cases to know when each one starts but instead I get: Stop Report Test Case running... Landmark Summary Test Case running... Mileage Summary Test Case running... Loaded suite C:/TestAutomation/workspace/QA_TestAutomation/gmmsunittests_Staging/reports/ reports_testsuite1 Started Has anyone experience this type of situation? thanks __________________________________________ Yahoo! DSL - Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From mb at michaelbolton.net Sat Jan 7 15:12:36 2006 From: mb at michaelbolton.net (Michael Bolton) Date: Sat, 7 Jan 2006 15:12:36 -0500 Subject: [Wtr-general] Newbie - How to get value found by searching forregular expression? Message-ID: <000c01c613c6$b48930e0$6801a8c0@Koko> If you change the regular expression from /[0-9]{8}-[0-9]/ to /([0-9]{8}-[0-9])/ then after the match, the variable $1 will contain the contents of the matched string. ---Michael B. _____ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Jon Passmore Sent: January 5, 2006 6:21 PM To: wtr-general at rubyforge.org Subject: [Wtr-general] Newbie - How to get value found by searching forregular expression? I can verify that a value exists that matches a regular expression, but how can I return that value? example: I add a record and it returns a page with a dynamically generated ID. The value does not have any tags that will help me locate it so I have to search using a regular expression. pageContainsText(/[0-9]{8}-[0-9]/) This works great, but what do I do if I want to return that value and assign it to a variable? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060107/858da6fe/attachment.html From mb at michaelbolton.net Sat Jan 7 15:12:36 2006 From: mb at michaelbolton.net (Michael Bolton) Date: Sat, 7 Jan 2006 15:12:36 -0500 Subject: [Wtr-general] PDF Testing using the Watir Message-ID: <001101c613c6$b52c9cd0$6801a8c0@Koko> I don't know how to answer your question in a way that would be helpful to you; one reason that you haven't got a response may be that your question is too general to inspire an answer. What do you mean by your question? What specific problem do you want to address? What testing problem do you want Watir to help you to solve? If the question is, "can I confirm that .PDF with a given name exists at such-and-such and address", WATIR might be able to help. If the question is, "can Watir help me to ensure that the content in the PDF addresses a given user's concerns", the answer is probably no. ---Michael B. _____ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Chintakrindi Meghanath Sent: January 5, 2006 6:56 AM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] PDF Testing using the Watir Hi All Yesterday I posted a request reagarding the PDF testing using Watir. But still so far there are no responses for this thread. Once again I am asking , is it possible to use Watir for testing the PDF documents. Thanks Meghanath -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org]On Behalf Of Chintakrindi Meghanath Sent: Wednesday, January 04, 2006 8:45 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] PDF Testing using the Watir Hi Can we test the PDF documents using the WATIR ? If yes, can anyone explain me how to do it. Thanks Meghanath Management Dynamics, Inc. ChintakrindiMeghana at ManagementDynamics.com Phone: 240.453.6507 Cell: 240.372.6241 www.ManagementDynamics.com The information contained in this e-mail message, including any attachments, constitutes proprietary and confidential information of Management Dynamics, Inc. and is intended only for the personal and confidential use of the recipient or recipients named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender immediately by e-mail and delete the original message. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060107/5bdc681f/attachment.html From mb at michaelbolton.net Sat Jan 7 15:12:36 2006 From: mb at michaelbolton.net (Michael Bolton) Date: Sat, 7 Jan 2006 15:12:36 -0500 Subject: [Wtr-general] selecting cells in Excell using activecell Message-ID: <001601c613c6$b5fdf690$6801a8c0@Koko> Hang on a sec. By assigning sheet = application, you're setting the sheet objection to the application object--which means you've lost access to the sheet object by reassigning it. If you simply said application.activecell.offset(1,0).activate you'd get the same effect, and you'd still have a sheet object. This is because ActiveCell is a property of the application, not of the workbook nor of the worksheet. You can confirm this by opening up an Excel sheet, choosing the menu bar's Tools / Macro / Visual Basic Editor, and then pressing F2 for the Object Browser. Double-click on ActiveCell and you'll see (about a third of the way up from the bottom of the screen) that it's a global property of Excel.Application. I presume this is because the authors of Excel's OLE Automation only wanted one active cell in the entire application, not one active cell per worksheet or workbook, but reading the minds of those folks is difficult. Note that none of this has anything to do with Ruby per se. They're not "the Ruby objects" here; they're OLE/COM objects. You would have encountered the same kinds of confusion were you using Visual Basic. (Lord knows I did.) One fine day, I'll write a really good Ruby-Excel interface. Don't hold your breath, though. :) ---Michael B. -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Beaton, Malcolm Sent: January 4, 2006 4:27 PM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] selecting cells in Excell using activecell THANK YOU MARK Works a treat Now excuse my ignorance but why does <> work but <> not work? My experience with Applescript suggests I was in the wrong object but the ruby objects still confuse me a little Malcolm Beaton -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Cain, Mark Sent: 04 January 2006 18:05 To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] selecting cells in Excell using activecell This you might find helpful http://rubygarden.org/ruby?ScriptingExcel Also, I was playing around with your script and this worked for me: sheet = application sheet.activecell.offset(1,0).activate --Mark -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Beaton, Malcolm Sent: Wednesday, January 04, 2006 9:15 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] selecting cells in Excell using activecell Maybe a little out of scope for this group but I am trying to write and retrieve cell data from Excel iteratively with ruby using the activecell property. Only problem is it does not seem to work. My script is basically require 'win32ole' application = WIN32OLE.new('Excel.Application') application.visible = TRUE workbook = application.Workbooks.Add(); worksheet = workbook.Worksheets(1); (1..4).each do |x| dirArray = ['North','South','East','West'] worksheet.Range('A' + (x.to_s)).value = dirArray[(x-1)] end sheet = application.activesheet sheet.activecell.offset(1,0).activate and I always get the error excell.rb:47:in `method_missing': Unknown property or method `activecell' (WIN32OLERuntimeError) Am I missing a lib or something? I can find no reference to other people having this issue Any help would be appreciated Malcolm Beaton _____________________________________________________________________ This e-mail has been scanned for viruses by MessageLabs. The information contained in this message is confidential and is intended for the addressee only. If you have received this message in error, please notify Conchango plc as soon as possible. The unauthorised use, disclosure, copying or alteration of this message is prohibited and may be unlawful. The internet cannot guarantee the integrity of this message and therefore Conchango plc will not be liable for the message if modified. Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784 222 222 F 44 (0) 1784 222 200 E talktous at conchango.com No. 2598884 _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _____________________________________________________________________ This e-mail has been scanned for viruses by MessageLabs. The information contained in this message is confidential and is intended for the addressee only. If you have received this message in error, please notify Conchango plc as soon as possible. The unauthorised use, disclosure, copying or alteration of this message is prohibited and may be unlawful. The internet cannot guarantee the integrity of this message and therefore Conchango plc will not be liable for the message if modified. Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784 222 222 F 44 (0) 1784 222 200 E talktous at conchango.com No. 2598884 _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From mb at michaelbolton.net Sat Jan 7 15:12:36 2006 From: mb at michaelbolton.net (Michael Bolton) Date: Sat, 7 Jan 2006 15:12:36 -0500 Subject: [Wtr-general] Is there way to find the parent nodes and child nodesof a tree structure in watir? Message-ID: <001701c613c6$b6a002f0$6801a8c0@Koko> On Mon, 26 Dec 2005 05:04:31 +0000 (GMT) chaya shetty wrote: Hi, The application under test has got a tree structure. I want to write a test case which invovles navigating through the tree structure and verifying whether the correct screen is displayed when the corresponding link is clicked. I am able to navigate through the tree structure by using the link index.I am retrieving the innertext of the link and then verifying whether that text is present on the other frame. The code that I am using link_index = 1 while(ie.frame(:index,tree_frame_index).link(:index,link_index).exists?) link_text = ie.frame(:index,tree_frame_index).link(:index,link_index).innerText ie.frame(:index,tree_frame_index).link(:index,link_index).click if $ie.frame(:index,text_frame_index).contains_text(link_text) puts "Test passed" else puts "Test failed" end link_index = link_index + 1 end Here the text of the child nodes are same for all the parent nodes. How do I know whether the text displayed of the child node belongs to the corresponding parent node? How would you know this if you /weren't/ using WATIR? That is, how would you determine correctness if you were clicking on the links manually and observing with own your eyes and brain? Is there way by which we can find out the parent nodes and child nodes of a tree structure in watir? If I understand your question correctly, you should be able to walk the application's pages as you're doing above (using Watir) and build a tree structure based on hashes (and hashes of hashes) or stacks (using Ruby). But so far as I know, there's no guarantee anywhere in Web-land that a given page is the parent of another. Several pages higher in a hierarchy can be pointing to the same page lower in it; thus a page can have many "parents". Pages can be related as parents and children simultaneously. That is, in math-speak, Web sites can be viewed as graphs, but there's nothing (other than someone's mental organizing model) that says that they are trees. Moveover, neither Ruby nor Watir knows anything about what constitutes correctness. Correctness will have to come from the heuristics that you program into your tests. That's why (for example), I would change "Test passed" and "Test failed" above to "child page contains text found in link on parent page" -- I would at least make that translation in my head. I know this might not get you what you want, but I hope it clarifies things. ---Michael B. DevelopSense: Software Testing in Plain English http://www.developsense.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060107/0390d4e1/attachment.html From mb at michaelbolton.net Sat Jan 7 15:12:36 2006 From: mb at michaelbolton.net (Michael Bolton) Date: Sat, 7 Jan 2006 15:12:36 -0500 Subject: [Wtr-general] Link that can not be found Message-ID: <001c01c613c6$b73d5460$6801a8c0@Koko> I'm resending this message because I don't believe that it ever appeared on the list. If it did, please pardon me. ---Michael B. A while back, someone wrote: > I am having the problem with the link of the following form: > Sign in > And it appears that the both lines below can not find the link to click: > ie.link(:name, "Sign in").click > ie.link(:name, "Sign in").click And someone else replied: > The portion of data you are looking at is the "text" of the link, not the name... > so, > ie.link( :text, "Sign in" ).click > should work. To which I TRIED to reply: Which actually raises an interesting point: somewhere in the Watir documentation is the notion that the easiest way to find the link is by id--the id= attribute inside the Anchor tag, which apparently is preferred under current markup language standards, or name--the name= attribute inside the Anchor tag, which is apparently deprecated. Looking by :text means that if the text on the link changes, the test breaks. The theory is that an id attribute will be changed less often than the text. That seems like a reasonable presumption in many cases. The HTML you use in your example might be part of a tutorial that you're doing, or it might be part of an application that you're testing. If the latter, you can ask the programmer nicely for more testability by asking for id attributes in the markup. I've found www.w3schools.com to be a useful resource for learning about markup language, browsers, and topics related to Web technology. Do others have similar places that they'd recommend? ---Michael B. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060107/7a805640/attachment.html From jkohl at telusplanet.net Sat Jan 7 22:02:36 2006 From: jkohl at telusplanet.net (Jonathan Kohl) Date: Sat, 7 Jan 2006 20:02:36 -0700 Subject: [Wtr-general] PDF Testing using the Watir In-Reply-To: <001101c613c6$b52c9cd0$6801a8c0@Koko> Message-ID: <000001c613ff$fb011c20$6500a8c0@tintin> PDF::Writer is probably the tool you'd want to look at: http://ruby-pdf.rubyforge.org/index.html but it currently doesn't support reading PDF docs. That feature is planned though, hopefully it will come out sometime this year: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/152071 -Jonathan ________________________________ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Michael Bolton Sent: January 7, 2006 1:13 PM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] PDF Testing using the Watir I don't know how to answer your question in a way that would be helpful to you; one reason that you haven't got a response may be that your question is too general to inspire an answer. What do you mean by your question? What specific problem do you want to address? What testing problem do you want Watir to help you to solve? If the question is, "can I confirm that .PDF with a given name exists at such-and-such and address", WATIR might be able to help. If the question is, "can Watir help me to ensure that the content in the PDF addresses a given user's concerns", the answer is probably no. ---Michael B. ________________________________ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Chintakrindi Meghanath Sent: January 5, 2006 6:56 AM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] PDF Testing using the Watir Hi All Yesterday I posted a request reagarding the PDF testing using Watir. But still so far there are no responses for this thread. Once again I am asking , is it possible to use Watir for testing the PDF documents. Thanks Meghanath -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org]On Behalf Of Chintakrindi Meghanath Sent: Wednesday, January 04, 2006 8:45 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] PDF Testing using the Watir Hi Can we test the PDF documents using the WATIR ? If yes, can anyone explain me how to do it. Thanks Meghanath Management Dynamics, Inc. ChintakrindiMeghana at ManagementDynamics.com Phone: 240.453.6507 Cell: 240.372.6241 www.ManagementDynamics.com The information contained in this e-mail message, including any attachments, constitutes proprietary and confidential information of Management Dynamics, Inc. and is intended only for the personal and confidential use of the recipient or recipients named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender immediately by e-mail and delete the original message. From PGarigue at EXTEND.COM Sun Jan 8 00:44:04 2006 From: PGarigue at EXTEND.COM (Pierre Garigue) Date: Sun, 8 Jan 2006 00:44:04 -0500 Subject: [Wtr-general] Newbie - How to get value found by searchingforregular expression? Message-ID: the tutorial http://gnosis.cx/publish/programming/regular_expressions.html had a few other things on regular expressions but you want the Ruby the pickaxe book http://www.pixelmech.com/notebook/2005/12/programming-ruby-the-pickaxe-book/ it has a whole chapter on using regular expressions in ruby -----Original Message----- From: Michael Bolton [mailto:mb at michaelbolton.net] Sent: Sat 07-Jan-06 3:12 PM To: wtr-general at rubyforge.org Cc: Subject: Re: [Wtr-general] Newbie - How to get value found by searchingforregular expression? If you change the regular expression from /[0-9]{8}-[0-9]/ to /([0-9]{8}-[0-9])/ then after the match, the variable $1 will contain the contents of the matched string. ---Michael B. _____ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Jon Passmore Sent: January 5, 2006 6:21 PM To: wtr-general at rubyforge.org Subject: [Wtr-general] Newbie - How to get value found by searching forregular expression? I can verify that a value exists that matches a regular expression, but how can I return that value? example: I add a record and it returns a page with a dynamically generated ID. The value does not have any tags that will help me locate it so I have to search using a regular expression. pageContainsText(/[0-9]{8}-[0-9]/) This works great, but what do I do if I want to return that value and assign it to a variable? From PGarigue at EXTEND.COM Sun Jan 8 01:01:37 2006 From: PGarigue at EXTEND.COM (Pierre Garigue) Date: Sun, 8 Jan 2006 01:01:37 -0500 Subject: [Wtr-general] Link that can not be found Message-ID: my experience is that asking for unique ID for links can work out well. What about for form items as well? Cheers Pierre Garigue -----Original Message----- From: Michael Bolton [mailto:mb at michaelbolton.net] Sent: Sat 07-Jan-06 3:12 PM To: wtr-general at rubyforge.org Cc: Subject: Re: [Wtr-general] Link that can not be found I'm resending this message because I don't believe that it ever appeared on the list. If it did, please pardon me. ---Michael B. A while back, someone wrote: > I am having the problem with the link of the following form: > Sign in > And it appears that the both lines below can not find the link to click: > ie.link(:name, "Sign in").click > ie.link(:name, "Sign in").click And someone else replied: > The portion of data you are looking at is the "text" of the link, not the name... > so, > ie.link( :text, "Sign in" ).click > should work. To which I TRIED to reply: Which actually raises an interesting point: somewhere in the Watir documentation is the notion that the easiest way to find the link is by id--the id= attribute inside the Anchor tag, which apparently is preferred under current markup language standards, or name--the name= attribute inside the Anchor tag, which is apparently deprecated. Looking by :text means that if the text on the link changes, the test breaks. The theory is that an id attribute will be changed less often than the text. That seems like a reasonable presumption in many cases. The HTML you use in your example might be part of a tutorial that you're doing, or it might be part of an application that you're testing. If the latter, you can ask the programmer nicely for more testability by asking for id attributes in the markup. I've found www.w3schools.com to be a useful resource for learning about markup language, browsers, and topics related to Web technology. Do others have similar places that they'd recommend? ---Michael B. From mb at michaelbolton.net Sun Jan 8 21:35:20 2006 From: mb at michaelbolton.net (Michael Bolton) Date: Sun, 8 Jan 2006 21:35:20 -0500 Subject: [Wtr-general] Newbie - How to get value found bysearchingforregular expression? In-Reply-To: Message-ID: <006b01c614c5$6108b030$6801a8c0@Koko> Thanks Pierre--added to the list. If you want to master regular expressions, you may wish to check out (*ahem*) _Mastering Regular Expressions_, an O'Reilly book by Jeffrey Friedl. The first few chapters are really helpful. The later ones discuss deterministic finite-state automata and non-deterministic finite-state automata--one would have to be geekier than I to appreciate them in their fullness. Regular expressions vary a good deal from implementation to implementation, so Pierre's resources may be more immediately useful to Rubyists. ---Michael B. -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Pierre Garigue Sent: January 8, 2006 12:44 AM To: wtr-general at rubyforge.org; wtr-general at rubyforge.org Subject: Re: [Wtr-general] Newbie - How to get value found bysearchingforregular expression? the tutorial http://gnosis.cx/publish/programming/regular_expressions.html had a few other things on regular expressions but you want the Ruby the pickaxe book http://www.pixelmech.com/notebook/2005/12/programming-ruby-the-pickaxe-book/ it has a whole chapter on using regular expressions in ruby [---Pierre Garigue, too shy to sign] -----Original Message----- From: Michael Bolton [mailto:mb at michaelbolton.net] Sent: Sat 07-Jan-06 3:12 PM To: wtr-general at rubyforge.org Cc: Subject: Re: [Wtr-general] Newbie - How to get value found by searchingforregular expression? If you change the regular expression from /[0-9]{8}-[0-9]/ to /([0-9]{8}-[0-9])/ then after the match, the variable $1 will contain the contents of the matched string. ---Michael B. _____ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Jon Passmore Sent: January 5, 2006 6:21 PM To: wtr-general at rubyforge.org Subject: [Wtr-general] Newbie - How to get value found by searching forregular expression? I can verify that a value exists that matches a regular expression, but how can I return that value? example: I add a record and it returns a page with a dynamically generated ID. The value does not have any tags that will help me locate it so I have to search using a regular expression. pageContainsText(/[0-9]{8}-[0-9]/) This works great, but what do I do if I want to return that value and assign it to a variable? _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From zeljko.filipin at gmail.com Mon Jan 9 04:46:48 2006 From: zeljko.filipin at gmail.com (Zeljko Filipin) Date: Mon, 9 Jan 2006 10:46:48 +0100 Subject: [Wtr-general] Link that can not be found In-Reply-To: <001c01c613c6$b73d5460$6801a8c0@Koko> References: <001c01c613c6$b73d5460$6801a8c0@Koko> Message-ID: +1 for www.w3schools.com Zeljko 2006/1/7, Michael Bolton : > > I'm resending this message because I don't believe that it ever appeared on > the list. If it did, please pardon me. > > ---Michael B. > > A while back, someone wrote: > > I am having the problem with the link of the following form: > > > Sign in > > > And it appears that the both lines below can not find the link to click: > > ie.link(:name, "Sign in").click > > ie.link(:name, "Sign in").click > > And someone else replied: > > The portion of data you are looking at is the "text" of the link, not the > name... > > > so, > > > ie.link( :text, "Sign in" ).click > > > should work. > > To which I TRIED to reply: > > > Which actually raises an interesting point: somewhere in the Watir > documentation is the notion that the easiest way to find the link is by > id--the id= attribute inside the Anchor tag, which apparently is preferred > under current markup language standards, or name--the name= attribute > inside the Anchor tag, which is apparently deprecated. Looking by :text > means that if the text on the link changes, the test breaks. The theory is > that an id attribute will be changed less often than the text. That seems > like a reasonable presumption in many cases. The HTML you use in your > example might be part of a tutorial that you're doing, or it might be part > of an application that you're testing. If the latter, you can ask the > programmer nicely for more testability by asking for id attributes in the > markup. > > I've found www.w3schools.com to be a useful resource for learning about > markup language, browsers, and topics related to Web technology. Do others > have similar places that they'd recommend? > > ---Michael B. > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > > > From Mark_Cain at rl.gov Mon Jan 9 11:24:07 2006 From: Mark_Cain at rl.gov (Cain, Mark) Date: Mon, 9 Jan 2006 08:24:07 -0800 Subject: [Wtr-general] Watir and Java Script onClick difficulties Message-ID: <9C0BD1E3DAF1204D842D72E2DCE2A04ED1D4F2@EX5V.rl.gov> Try this, I was able to get it to work here: def test_ClickEvent $ie.goto("http://www.gruposantander.es/") table = $ie.table(:index, 10) table[9][1].image(:src, /imagenes\/boton_entrar.gif/).fire_event("onClick") end Also, the .flash method is useful to find were you are on the page when working with indexes. table = $ie.table(:index, 10).flash Hope this helps, --Mark -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of e aldaz Sent: Saturday, January 07, 2006 11:21 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] Watir and Java Script onClick difficulties Dear All I am quite new to Ruby and Watir (but have bought and read the famous PickAke). I have had quite a lot of success using Watir on normal HTML pages, however i am having all sorts of trouble with some java script. I was wondering if someone could: 1.- Tell me where to find documentation on using watir with pages that have javascript 2.- Help me with this particular example, i need to click on a button called entrar, that appears as an image in "http://www.gruposantander.es" under "Supernet acceso particulares" From what i gather if i need to click on a button or image or link that starts some java script i need to do something like: ie.button(...).fire_event("onClick") or ie.image(...)..fire_event("onClick") etc.. However i have not been able to get the onClick that appears on the following HTML table (frow view source of the page) to fire, Transmisión segura de sus datos

personales, SSL 128 bits   Any ideas how to do it? I have tried $ie.link(:url, "#").fire_event("onClick") but I get irb(main):029:0> ie.link(:url,"#").fire_event("onClick") Watir::Exception::UnknownObjectException: Unable to locate object, using url and # I've also tried beforeText, afterText,etc.. but can't seem to get it to work Using index i can activate other links, but not this particular one Any help much appreciated ! Thanks Eduardo _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060109/44f98a63/attachment.html From ardhazes at yahoo.com Mon Jan 9 16:44:48 2006 From: ardhazes at yahoo.com (e aldaz) Date: Mon, 9 Jan 2006 21:44:48 +0000 (GMT) Subject: [Wtr-general] Watir and Java Script onClick difficulties In-Reply-To: <9C0BD1E3DAF1204D842D72E2DCE2A04ED1D4F2@EX5V.rl.gov> Message-ID: <20060109214448.72835.qmail@web51814.mail.yahoo.com> Mark, It works great, thank you very much, i'll keep on trying with the rest now! --- "Cain, Mark" wrote: > Try this, I was able to get it to work here: > > > > def test_ClickEvent > > $ie.goto("http://www.gruposantander.es/") > > > > table = $ie.table(:index, 10) > > table[9][1].image(:src, > /imagenes\/boton_entrar.gif/).fire_event("onClick") > > > > end > > > > Also, the .flash method is useful to find were you > are on the page when > working with indexes. > > table = $ie.table(:index, 10).flash > > > > Hope this helps, > > > > --Mark > > > > -----Original Message----- > From: wtr-general-bounces at rubyforge.org > [mailto:wtr-general-bounces at rubyforge.org] On Behalf > Of e aldaz > Sent: Saturday, January 07, 2006 11:21 AM > To: wtr-general at rubyforge.org > Subject: [Wtr-general] Watir and Java Script onClick > difficulties > > > > Dear All > > > > I am quite new to Ruby and Watir (but have bought > and > > read the famous PickAke). > > I have had quite a lot of success using Watir on > > normal HTML pages, however i am having all sorts of > > trouble with some java script. > > I was wondering if someone could: > > > > 1.- Tell me where to find documentation on using > watir > > with pages that have javascript > > > > 2.- Help me with this particular example, i need to > > click on a button called entrar, that appears as an > > image in "http://www.gruposantander.es" under > > "Supernet acceso particulares" > > From what i gather if i need to click on a > button > > or image or link that starts some java script i need > > to do something like: > > ie.button(...).fire_event("onClick") > > or > > ie.image(...)..fire_event("onClick") > > etc.. > > > > However i have not been able to get the onClick > > that appears on the following HTML table (frow view > > source of the page) to fire, > > > > > valign="middle" class="TextoUtilidadesNegro"> > href="#" onClick="checkloginparticulares();return > > false;"> > width="84" height="17" border="0" > > alt="Transmisión segura de sus datos > > personales, SSL 128 bits">   > > > > Any ideas how to do it? > > I have tried $ie.link(:url, > > "#").fire_event("onClick") > > but I get > > irb(main):029:0> > > ie.link(:url,"#").fire_event("onClick") > > Watir::Exception::UnknownObjectException: Unable to > > locate object, using url and # > > > > I've also tried beforeText, afterText,etc.. but > can't > > seem to get it to work > > Using index i can activate other links, but not this > > particular one > > > > Any help much appreciated ! > > Thanks > > Eduardo > > > > > > _______________________________________________ > > Wtr-general mailing list > > Wtr-general at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wtr-general > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > From christopher.mcmahon at gmail.com Mon Jan 9 18:41:11 2006 From: christopher.mcmahon at gmail.com (Chris McMahon) Date: Mon, 9 Jan 2006 17:41:11 -0600 Subject: [Wtr-general] selecting cells in Excell using activecell In-Reply-To: <001601c613c6$b5fdf690$6801a8c0@Koko> References: <001601c613c6$b5fdf690$6801a8c0@Koko> Message-ID: <72799cd70601091541y4d6f72d0p6177cf2f6564eeeb@mail.gmail.com> > One fine day, I'll write a really good Ruby-Excel interface. Don't hold > your breath, though. :) > > ---Michael B. If you're serious, I know some people who might help. I know other people who'd use such an interface, too. Some encouragement: it's a classic example of a DSL, and we all know how easy it is do DSLs in Ruby. And you really need the practice implementing a Domain Specific Language, don't you? All the cool kids are doing it... -Chris From ash_mita at yahoo.com Tue Jan 10 03:52:57 2006 From: ash_mita at yahoo.com (Asmita Srivastava) Date: Tue, 10 Jan 2006 00:52:57 -0800 (PST) Subject: [Wtr-general] Wtr-general Digest, Vol 26, Issue 9 In-Reply-To: Message-ID: <20060110085257.36042.qmail@web51605.mail.yahoo.com> Hi, This is in response to the Message -1 (Subject : Link that can not be found) Links can be recognized by its id,index and url . For links where no id or index defined , it can be accessed using url ie. for : Sign in we can use $ie.link(:url,/some address/).click example to click on link DCK to click on this link the watir code will be $ie.link(:url,/'>RTMaint.do/).click This will work Regards, wtr-general-request at rubyforge.org wrote: Send Wtr-general mailing list submissions to wtr-general at rubyforge.org 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 wtr-general-request at rubyforge.org You can reach the person managing the list at wtr-general-owner at rubyforge.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Wtr-general digest..." Today's Topics: 1. Re: Link that can not be found (Zeljko Filipin) 2. Re: Watir and Java Script onClick difficulties (Cain, Mark) 3. Re: Watir and Java Script onClick difficulties (e aldaz) 4. Re: selecting cells in Excell using activecell (Chris McMahon) ---------------------------------------------------------------------- Message: 1 Date: Mon, 9 Jan 2006 10:46:48 +0100 From: Zeljko Filipin Subject: Re: [Wtr-general] Link that can not be found To: wtr-general at rubyforge.org Message-ID: Content-Type: text/plain; charset=ISO-8859-1 +1 for www.w3schools.com Zeljko 2006/1/7, Michael Bolton : > > I'm resending this message because I don't believe that it ever appeared on > the list. If it did, please pardon me. > > ---Michael B. > > A while back, someone wrote: > > I am having the problem with the link of the following form: > > > Sign in > > > And it appears that the both lines below can not find the link to click: > > ie.link(:name, "Sign in").click > > ie.link(:name, "Sign in").click > > And someone else replied: > > The portion of data you are looking at is the "text" of the link, not the > name... > > > so, > > > ie.link( :text, "Sign in" ).click > > > should work. > > To which I TRIED to reply: > > > Which actually raises an interesting point: somewhere in the Watir > documentation is the notion that the easiest way to find the link is by > id--the id= attribute inside the Anchor tag, which apparently is preferred > under current markup language standards, or name--the name= attribute > inside the Anchor tag, which is apparently deprecated. Looking by :text > means that if the text on the link changes, the test breaks. The theory is > that an id attribute will be changed less often than the text. That seems > like a reasonable presumption in many cases. The HTML you use in your > example might be part of a tutorial that you're doing, or it might be part > of an application that you're testing. If the latter, you can ask the > programmer nicely for more testability by asking for id attributes in the > markup. > > I've found www.w3schools.com to be a useful resource for learning about > markup language, browsers, and topics related to Web technology. Do others > have similar places that they'd recommend? > > ---Michael B. > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > > > ------------------------------ Message: 2 Date: Mon, 9 Jan 2006 08:24:07 -0800 From: "Cain, Mark" Subject: Re: [Wtr-general] Watir and Java Script onClick difficulties To: Message-ID: <9C0BD1E3DAF1204D842D72E2DCE2A04ED1D4F2 at EX5V.rl.gov> Content-Type: text/plain; charset="us-ascii" Try this, I was able to get it to work here: def test_ClickEvent $ie.goto("http://www.gruposantander.es/") table = $ie.table(:index, 10) table[9][1].image(:src, /imagenes\/boton_entrar.gif/).fire_event("onClick") end Also, the .flash method is useful to find were you are on the page when working with indexes. table = $ie.table(:index, 10).flash Hope this helps, --Mark -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of e aldaz Sent: Saturday, January 07, 2006 11:21 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] Watir and Java Script onClick difficulties Dear All I am quite new to Ruby and Watir (but have bought and read the famous PickAke). I have had quite a lot of success using Watir on normal HTML pages, however i am having all sorts of trouble with some java script. I was wondering if someone could: 1.- Tell me where to find documentation on using watir with pages that have javascript 2.- Help me with this particular example, i need to click on a button called entrar, that appears as an image in "http://www.gruposantander.es" under "Supernet acceso particulares" >From what i gather if i need to click on a button or image or link that starts some java script i need to do something like: ie.button(...).fire_event("onClick") or ie.image(...)..fire_event("onClick") etc.. However i have not been able to get the onClick that appears on the following HTML table (frow view source of the page) to fire, valign="middle" class="TextoUtilidadesNegro"> href="#" onClick="checkloginparticulares();return false;"> width="84" height="17" border="0" alt="Transmisi?n segura de sus datos personales, SSL 128 bits"> Any ideas how to do it? I have tried $ie.link(:url, "#").fire_event("onClick") but I get irb(main):029:0> ie.link(:url,"#").fire_event("onClick") Watir::Exception::UnknownObjectException: Unable to locate object, using url and # I've also tried beforeText, afterText,etc.. but can't seem to get it to work Using index i can activate other links, but not this particular one Any help much appreciated ! Thanks Eduardo _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060109/44f98a63/attachment-0001.htm ------------------------------ Message: 3 Date: Mon, 9 Jan 2006 21:44:48 +0000 (GMT) From: e aldaz Subject: Re: [Wtr-general] Watir and Java Script onClick difficulties To: wtr-general at rubyforge.org Message-ID: <20060109214448.72835.qmail at web51814.mail.yahoo.com> Content-Type: text/plain; charset=iso-8859-1 Mark, It works great, thank you very much, i'll keep on trying with the rest now! --- "Cain, Mark" wrote: > Try this, I was able to get it to work here: > > > > def test_ClickEvent > > $ie.goto("http://www.gruposantander.es/") > > > > table = $ie.table(:index, 10) > > table[9][1].image(:src, > /imagenes\/boton_entrar.gif/).fire_event("onClick") > > > > end > > > > Also, the .flash method is useful to find were you > are on the page when > working with indexes. > > table = $ie.table(:index, 10).flash > > > > Hope this helps, > > > > --Mark > > > > -----Original Message----- > From: wtr-general-bounces at rubyforge.org > [mailto:wtr-general-bounces at rubyforge.org] On Behalf > Of e aldaz > Sent: Saturday, January 07, 2006 11:21 AM > To: wtr-general at rubyforge.org > Subject: [Wtr-general] Watir and Java Script onClick > difficulties > > > > Dear All > > > > I am quite new to Ruby and Watir (but have bought > and > > read the famous PickAke). > > I have had quite a lot of success using Watir on > > normal HTML pages, however i am having all sorts of > > trouble with some java script. > > I was wondering if someone could: > > > > 1.- Tell me where to find documentation on using > watir > > with pages that have javascript > > > > 2.- Help me with this particular example, i need to > > click on a button called entrar, that appears as an > > image in "http://www.gruposantander.es" under > > "Supernet acceso particulares" > > From what i gather if i need to click on a > button > > or image or link that starts some java script i need > > to do something like: > > ie.button(...).fire_event("onClick") > > or > > ie.image(...)..fire_event("onClick") > > etc.. > > > > However i have not been able to get the onClick > > that appears on the following HTML table (frow view > > source of the page) to fire, > > > > > > valign="middle" class="TextoUtilidadesNegro">> > href="#" onClick="checkloginparticulares();return > > false;">> > width="84" height="17" border="0" > > alt="Transmisi?n segura de sus datos > > personales, SSL 128 bits"> > > > > Any ideas how to do it? > > I have tried $ie.link(:url, > > "#").fire_event("onClick") > > but I get > > irb(main):029:0> > > ie.link(:url,"#").fire_event("onClick") > > Watir::Exception::UnknownObjectException: Unable to > > locate object, using url and # > > > > I've also tried beforeText, afterText,etc.. but > can't > > seem to get it to work > > Using index i can activate other links, but not this > > particular one > > > > Any help much appreciated ! > > Thanks > > Eduardo > > > > > > _______________________________________________ > > Wtr-general mailing list > > Wtr-general at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wtr-general > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > ------------------------------ Message: 4 Date: Mon, 9 Jan 2006 17:41:11 -0600 From: Chris McMahon Subject: Re: [Wtr-general] selecting cells in Excell using activecell To: wtr-general at rubyforge.org Message-ID: <72799cd70601091541y4d6f72d0p6177cf2f6564eeeb at mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 > One fine day, I'll write a really good Ruby-Excel interface. Don't hold > your breath, though. :) > > ---Michael B. If you're serious, I know some people who might help. I know other people who'd use such an interface, too. Some encouragement: it's a classic example of a DSL, and we all know how easy it is do DSLs in Ruby. And you really need the practice implementing a Domain Specific Language, don't you? All the cool kids are doing it... -Chris ------------------------------ _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general End of Wtr-general Digest, Vol 26, Issue 9 ****************************************** --------------------------------- Yahoo! Photos ? Showcase holiday pictures in hardcover Photo Books. You design it and we?ll bind it! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060110/3c3cd770/attachment.html From mb at michaelbolton.net Tue Jan 10 09:39:00 2006 From: mb at michaelbolton.net (Michael Bolton) Date: Tue, 10 Jan 2006 09:39:00 -0500 Subject: [Wtr-general] selecting cells in Excell using activecell In-Reply-To: <72799cd70601091541y4d6f72d0p6177cf2f6564eeeb@mail.gmail.com> Message-ID: <009a01c615f3$a544bee0$6801a8c0@Koko> From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Chris McMahon Sent: January 9, 2006 6:41 PM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] selecting cells in Excell using activecell > One fine day, I'll write a really good Ruby-Excel interface. Don't hold > your breath, though. :) > > ---Michael B. >If you're serious, I know some people who might help. I know other >people who'd use such an interface, too. >Some encouragement: it's a classic example of a DSL, and we all know >how easy it is do DSLs in Ruby. And you really need the practice >implementing a Domain Specific Language, don't you? All the cool >kids are doing it... >-Chris I wonder how many people would be thrown by my desire to build objects like CellPointers, and calls like p = CellPointer.new() p.goto("$A$5") which don't exist in current Excel-speak. ---Michael B. From christopher.mcmahon at gmail.com Tue Jan 10 10:12:35 2006 From: christopher.mcmahon at gmail.com (Chris McMahon) Date: Tue, 10 Jan 2006 09:12:35 -0600 Subject: [Wtr-general] selecting cells in Excell using activecell In-Reply-To: <009a01c615f3$a544bee0$6801a8c0@Koko> References: <72799cd70601091541y4d6f72d0p6177cf2f6564eeeb@mail.gmail.com> <009a01c615f3$a544bee0$6801a8c0@Koko> Message-ID: <72799cd70601100712h2aae2bb5wdda07d93cde61653@mail.gmail.com> > I wonder how many people would be thrown by my desire to build objects like > CellPointers, and calls like > > p = CellPointer.new() > p.goto("$A$5") Go for it. What causes me to pull my hair out are the inability to address a cell by column number in the Range function; and all of the goofy numerical constants, like "-4161" to go to the end of the row. -Chris From PGarigue at EXTEND.COM Tue Jan 10 10:37:08 2006 From: PGarigue at EXTEND.COM (Pierre Garigue) Date: Tue, 10 Jan 2006 10:37:08 -0500 Subject: [Wtr-general] selecting cells in Excell using activecell Message-ID: I think a few would be. One you have a cell object it would be pretty easy to set them a formula, a display etc. I would by kid of cool to read data from Excel, and output to a spreadsheet. Cheers Pierre -----Original Message----- From: Michael Bolton [mailto:mb at michaelbolton.net] Sent: Tuesday, January 10, 2006 9:39 AM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] selecting cells in Excell using activecell From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Chris McMahon Sent: January 9, 2006 6:41 PM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] selecting cells in Excell using activecell > One fine day, I'll write a really good Ruby-Excel interface. Don't hold > your breath, though. :) > > ---Michael B. >If you're serious, I know some people who might help. I know other >people who'd use such an interface, too. >Some encouragement: it's a classic example of a DSL, and we all know >how easy it is do DSLs in Ruby. And you really need the practice >implementing a Domain Specific Language, don't you? All the cool >kids are doing it... >-Chris I wonder how many people would be thrown by my desire to build objects like CellPointers, and calls like p = CellPointer.new() p.goto("$A$5") which don't exist in current Excel-speak. ---Michael B. _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From pat at cappelaere.com Tue Jan 10 17:02:35 2006 From: pat at cappelaere.com (Pat Cappelaere) Date: Tue, 10 Jan 2006 17:02:35 -0500 Subject: [Wtr-general] WATIR 1.4.1 Did something happen? In-Reply-To: Message-ID: I just did a gem install watir Watir.rb now shows # Version "$Revision: 1.211.2.2 $" It used to be at least 1.269 (But I do not have that file anymore...) And it appears that elements_by_xpath are undefined... Did something happen? Thanks. Pat. From Ben.Torres at rhi.com Tue Jan 10 19:38:59 2006 From: Ben.Torres at rhi.com (Torres, Ben (HQP)) Date: Tue, 10 Jan 2006 16:38:59 -0800 Subject: [Wtr-general] Read In from external file Message-ID: <1641BB0AA7287848817A63C3EE9677D50A269CB2@hqp-ex-mb05.na.msds.rhi.com> Hello, Can Watir read from an external file and plug that data into a script? If so, how? Ex: I have var1 = city, var2 = state, var3 = zip. Can I have a file containing just different values for these variables and have the script take in these values: "San Francisco","California","94404" "Dallas","Texas","32345" "Miami","Florida","22342" So I will have my script run 3 times and each run will grab 1 line. Thanks in advance, Ben From ati.ozgur at gmail.com Tue Jan 10 20:10:14 2006 From: ati.ozgur at gmail.com (Atilla Ozgur) Date: Wed, 11 Jan 2006 03:10:14 +0200 Subject: [Wtr-general] Read In from external file In-Reply-To: <1641BB0AA7287848817A63C3EE9677D50A269CB2@hqp-ex-mb05.na.msds.rhi.com> References: <1641BB0AA7287848817A63C3EE9677D50A269CB2@hqp-ex-mb05.na.msds.rhi.com> Message-ID: since watir uses ruby for scripting, you can do that. Look for this page. http://www.rubycentral.com/book/tut_io.html but a simple example aFile = File.new("testfile.txt") aFile.each_line {|line| puts "Got #{line.dump}" vars = line.split(",") city = vars[0] state = vars[1] postal_code = vars[2] puts city puts state puts postal_code puts } with your file, this will output Got "\"San Francisco\",\"California\",\"94404\"\n" "San Francisco" "California" "94404" Got "\"Dallas\",\"Texas\",\"32345\"\n" "Dallas" "Texas" "32345" Got "\"Miami\",\"Florida\",\"22342\"" "Miami" "Florida" "22342" From spammer.sbt at gmail.com Tue Jan 10 20:21:05 2006 From: spammer.sbt at gmail.com (Steve Tangsombatvisit) Date: Tue, 10 Jan 2006 17:21:05 -0800 Subject: [Wtr-general] Read In from external file References: <1641BB0AA7287848817A63C3EE9677D50A269CB2@hqp-ex-mb05.na.msds.rhi.com> Message-ID: <00c201c6164d$522d4830$6bb0a042@corp.lyris.com> Hi Ben, That's very easy to do via Ruby 1. Create file object using the following code input_file = File.open("data.txt", "r") 2. There are many ways to iterate through the file or read data from the file depending on what you need to do. To go through the file line-by-line it would be input_file.each_line{|line| line = line.chop() .... .... .... } 3. Then close the handle when you are done input_file.close() Hope that helps. Steve ----- Original Message ----- From: "Torres, Ben (HQP)" To: Sent: Tuesday, January 10, 2006 4:38 PM Subject: [Wtr-general] Read In from external file > Hello, > > Can Watir read from an external file and plug that data into a script? > If so, how? > > Ex: I have var1 = city, var2 = state, var3 = zip. Can I have a file > containing just different values for these variables and have the script > take in these values: > > "San Francisco","California","94404" > "Dallas","Texas","32345" > "Miami","Florida","22342" > > So I will have my script run 3 times and each run will grab 1 line. > > Thanks in advance, > Ben > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general From zeljko.filipin at gmail.com Wed Jan 11 05:55:38 2006 From: zeljko.filipin at gmail.com (Zeljko Filipin) Date: Wed, 11 Jan 2006 11:55:38 +0100 Subject: [Wtr-general] WATIR 1.4.1 Did something happen? In-Reply-To: References: Message-ID: I guess that you used to install watir from "Download tarball". Gem version is usually older. Also, I think that elements_by_xpath is not included in 1.4.1, only in HEAD (but I am not sure). Zeljko 2006/1/10, Pat Cappelaere : > I just did a gem install watir > Watir.rb now shows # Version "$Revision: 1.211.2.2 $" > It used to be at least 1.269 (But I do not have that file anymore...) > And it appears that elements_by_xpath are undefined... > Did something happen? > Thanks. > Pat. > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > From zeljko.filipin at gmail.com Wed Jan 11 05:58:00 2006 From: zeljko.filipin at gmail.com (Zeljko Filipin) Date: Wed, 11 Jan 2006 11:58:00 +0100 Subject: [Wtr-general] Read In from external file In-Reply-To: <1641BB0AA7287848817A63C3EE9677D50A269CB2@hqp-ex-mb05.na.msds.rhi.com> References: <1641BB0AA7287848817A63C3EE9677D50A269CB2@hqp-ex-mb05.na.msds.rhi.com> Message-ID: I use yaml (http://yaml4r.sourceforge.net/). Try it, you will love it. Zeljko 2006/1/11, Torres, Ben (HQP) : > Hello, > > Can Watir read from an external file and plug that data into a script? > If so, how? > > Ex: I have var1 = city, var2 = state, var3 = zip. Can I have a file > containing just different values for these variables and have the script > take in these values: > > "San Francisco","California","94404" > "Dallas","Texas","32345" > "Miami","Florida","22342" > > So I will have my script run 3 times and each run will grab 1 line. > > Thanks in advance, > Ben > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > From PGarigue at EXTEND.COM Wed Jan 11 11:11:04 2006 From: PGarigue at EXTEND.COM (Pierre Garigue) Date: Wed, 11 Jan 2006 11:11:04 -0500 Subject: [Wtr-general] Read In from external file Message-ID: I write my yaml data by hand, this has helped me check that everything is OK. ------------------ require 'yaml' require 'pp' info_for_test = YAML::load( File.open('data_for_test.yml' )) pp info_for_test --------------------------------------- Since I came from the Perl world, I tend to think that all the world's problems can be solved by always using a hash. So as you can imagine, info_for_test would be a hash variable. -pierre garigue -----Original Message----- From: Zeljko Filipin [mailto:zeljko.filipin at gmail.com] Sent: Wednesday, January 11, 2006 5:58 AM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] Read In from external file I use yaml (http://yaml4r.sourceforge.net/). Try it, you will love it. Zeljko 2006/1/11, Torres, Ben (HQP) : > Hello, > > Can Watir read from an external file and plug that data into a script? > If so, how? > > Ex: I have var1 = city, var2 = state, var3 = zip. Can I have a file > containing just different values for these variables and have the script > take in these values: > > "San Francisco","California","94404" > "Dallas","Texas","32345" > "Miami","Florida","22342" > > So I will have my script run 3 times and each run will grab 1 line. > > Thanks in advance, > Ben > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From peppers at gmail.com Wed Jan 11 11:31:30 2006 From: peppers at gmail.com (Terry Peppers) Date: Wed, 11 Jan 2006 10:31:30 -0600 Subject: [Wtr-general] Design Problems Message-ID: <8ca48b420601110831h670e4247rd05bfe16ca41b0bf@mail.gmail.com> I'm kind of @ a crossroads right now and I think my inexperience as a developer is beginning to shine pretty hard. Here's my general problem: I'm trying to compose a generic test that I can use to test many different sites - however, each site behaves slightly different then the other sites. So I'm @ a bit of a design quandry. An example: class OrderTest < Test::Unit::TestCase def setup @ie = IE.new @ie.goto("http://www.store1.com") @ie.wait end def order_something # pick a product @ie.link(:name, "some_product).click # do some assertions # ... # click @ie.button(:name, "done").click # fill in some data # do some assertions # ... @ie.text_field(:name, "fname").set("Terry") @ie.text_field(:name, "lname").set("Peppers") @ie.text_field(:name, "address").set("123 Foo") @ie.text_field(:name, "zip").set("90210") @ie.text_field(:name, "city").set("Foobar") @ie.text_field(:name, "state").set("FO") # click @ie.button(:name, "submit").click # do some assertions # ... end def teardown @ie.close end end So this example works great for 'store1' but what happens if I want to test 'store2.' 'Store2' requires a credit card and wants to ask you some questions. Right now I'm cluttering up my test case with a lot of conditionals/case statements so that it can react accordingly, but that doesn't seem really elegant to me. Does anyone know of a better way to do this? I was chewing on possibly creating a 'order_something' object that could insert the proper steps and assertions based on the 'store' that it's testing - but to be honest I'm not even sure how to do that. Also, maybe this is a place where exceptions should be used - I don't think so, but I don't know. Any ideas? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060111/2195712f/attachment.html From christopher.mcmahon at gmail.com Wed Jan 11 11:48:00 2006 From: christopher.mcmahon at gmail.com (Chris McMahon) Date: Wed, 11 Jan 2006 10:48:00 -0600 Subject: [Wtr-general] Design Problems In-Reply-To: <8ca48b420601110831h670e4247rd05bfe16ca41b0bf@mail.gmail.com> References: <8ca48b420601110831h670e4247rd05bfe16ca41b0bf@mail.gmail.com> Message-ID: <72799cd70601110848x519c4a9dt3f8d1f9912c654bb@mail.gmail.com> Hi Terry... I hope better programmers than me comment, this is a really good question. > Right now I'm cluttering up my test case with a lot of conditionals/case > statements so that it can react accordingly, but that doesn't seem really > elegant to me. Does anyone know of a better way to do this? A general design rule of thumb is to substitute methods for conditionals. I know that sounds all abstract and stuff, but here's a concrete example. I have an app that shows 10 things at a time on an arbitrarily large number of pages. So I'll write a method like this: def check_for_next_page @ie.links.each do |link| if link.href =~ /b_start/ and link.text =~ /Next/ and link.text =~ /items/ process_next_page_method link.click end end end #def So above that I have another method that will process the page *if the page exists*: def process_next_page_method @ie.links.each do |link| if link.href =~ /IWantThisLink/ link.href =~/\d+/ @data_array<<$& #puts $& end end #def That way only one conditional per page, one conditional per link per page. I hope that makes sense, good luck. BTW, I bet if you google something like "ruby conditionals methods" you might find useful stuff, too. -Chris From mb at michaelbolton.net Wed Jan 11 12:30:10 2006 From: mb at michaelbolton.net (Michael Bolton) Date: Wed, 11 Jan 2006 12:30:10 -0500 Subject: [Wtr-general] Design Problems In-Reply-To: <8ca48b420601110831h670e4247rd05bfe16ca41b0bf@mail.gmail.com> Message-ID: <000001c616d4$ac74ee60$6801a8c0@Koko> I would like gently to suggest that your inexperience as a developer isn't the problem here. This is a fundamental question about test automation in general. You're not alone; I'm not convinced that very many people have thought particularly hard about it. I think enough time has gone by that people now understand that a debugger will neither find nor fix your bugs. In a similar kind of way, WATIR will not use or test your application; YOU will. WATIR will help you to do that by pressing keys or performing mouse clicks, scanning the screen and reacting to patterns that you've told it about, and doing all that really quickly. So: if Store 2 requires you to answer some questions, what would those questions be? If Store 2 requires you to behave differently, what are the differences? At what point do they diverge from the behaviours for Store 1? The fundamental problem is: what do you mean by "a generic test"? For me to answer this question in a way that would help you, I would have to know what you would do manually and cognitively if you didn't have WATIR available. Then solving the programming problem is relatively straightforward. Relatively. And I don't think you'll need our help as much as you might think you do. One way you can do some of the things that you're doing below is to take the "do some assertions" part, and wrap those into a method that /isn't/ a test_something method, and to take the stuff where you enter data and do something similar, such that we might see def test_store_1 login_to_store_1 order_some_product fill_in_some_data click_submit logout end def_test_store_2 login_to_store_2 order_some_product fill_in_some_data click_submit logout end def login_to_store_1 enter_user_name_and_password end def login_to_store_2 enter_user_name_and_password enter_credit_card_info answer_some_questions end def fill_in_some_data @ie.text_field(:name, "fname").set("Terry") @ie.text_field(:name, "lname").set("Peppers") @ie.text_field(:name, "address").set("123 Foo") @ie.text_field(:name, "zip").set("90210") @ie.text_field(:name, "city").set("Foobar") @ie.text_field(:name, "state").set("FO") end def click_submit @ie.button(:name, "submit").click end On the other hand, if the stores themselves don't behave generically, then the tests will have to incorporate behaviour that's appropriate to the differences: def_test_store_2 login_to_store_2 jump_through_extra_store_2_hoops order_some_product fill_in_some_generic_data fill_in_other_stuff_specific_to_store_2 click_submit logout end You see? ---Michael B. _____ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Terry Peppers Sent: January 11, 2006 11:32 AM To: wtr-general at rubyforge.org Subject: [Wtr-general] Design Problems I'm kind of @ a crossroads right now and I think my inexperience as a developer is beginning to shine pretty hard. Here's my general problem: I'm trying to compose a generic test that I can use to test many different sites - however, each site behaves slightly different then the other sites. So I'm @ a bit of a design quandry. An example: class OrderTest < Test::Unit::TestCase def setup @ie = IE.new @ie.goto("http://www.store1.com") @ie.wait end def order_something # pick a product @ie.link(:name, "some_product).click # do some assertions # ... # click @ie.button(:name, "done").click # fill in some data # do some assertions # ... @ie.text_field(:name, "fname").set("Terry") @ie.text_field(:name, "lname").set("Peppers") @ie.text_field(:name, "address").set("123 Foo") @ie.text_field(:name, "zip").set("90210") @ie.text_field(:name, "city").set("Foobar") @ie.text_field(:name, "state").set("FO") # click @ie.button(:name, "submit").click # do some assertions # ... end def teardown @ie.close end end So this example works great for 'store1' but what happens if I want to test 'store2.' 'Store2' requires a credit card and wants to ask you some questions. Right now I'm cluttering up my test case with a lot of conditionals/case statements so that it can react accordingly, but that doesn't seem really elegant to me. Does anyone know of a better way to do this? I was chewing on possibly creating a 'order_something' object that could insert the proper steps and assertions based on the 'store' that it's testing - but to be honest I'm not even sure how to do that. Also, maybe this is a place where exceptions should be used - I don't think so, but I don't know. Any ideas? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060111/0a5dcd8b/attachment.html From spammer.sbt at gmail.com Wed Jan 11 15:34:12 2006 From: spammer.sbt at gmail.com (Steve Tangsombatvisit) Date: Wed, 11 Jan 2006 12:34:12 -0800 Subject: [Wtr-general] Design Problems References: <8ca48b420601110831h670e4247rd05bfe16ca41b0bf@mail.gmail.com> Message-ID: <019701c616ee$6249f780$6bb0a042@corp.lyris.com> >> Does anyone know of a better way to do this? I was chewing on possibly creating a 'order_something' object that could insert the proper steps and assertions based on the 'store' that it's testing - but to >> be honest I'm not even sure how to do that. Also, maybe this is a place where exceptions should be used - I don't think so, but I don't know. Any ideas? Hi Terry, I think your on the right path with this thought. Perhaps create one main Store object with characteristics common to all Stores (ie logon, user name, password, account number) and then have child Stores inherit from the parent Store object with more specific charactersitics. You then initialize each Store accordingly and define them only in the specific test case they are needed. As you'll probably see, there are many ways to approach this. How i have approached something like this in the past is would be to give each Store object a "setup" and "test" method, which is then called from within the specific test cases. This way, your main test file would be tiny. You can then write your individual test script as a method inside your Store objects. I don't know if this will help you cut down on the amount of code you need to write class OrderTest < Test::Unit::TestCase def setup end def test_store_01 store_1 = Store.new(..) store_1.setup() assert (store_1.test()..... end def test_store_02 store_2= Store.new(.