From michaelr at ibsglobalweb.com Thu Jun 1 02:43:58 2006 From: michaelr at ibsglobalweb.com (Michael Ruschena) Date: Thu, 1 Jun 2006 16:43:58 +1000 Subject: [Wtr-general] How can I open and attach file using file_field method? Message-ID: <20060601064359.712D4430003@ibsglobalweb.com> I encountered this problem yesterday, and unlike the mail archives, I have an answer. I was getting exactly the behavior described below: 1) I would run a script using file_field.set 2) The script would get to the set method 3a) the choose file window would be invoked 3b) the file setFileDialog.rb would be opened in my ruby editor 3c) the script would sit there waiting for me to take manual action. 4) As soon as I take manual action to close the window, the script would resume Messing around with autoit, and the other suggestions didn't help at all. The problem seems to be caused by associating *.rb files with an IDE. When the set method attempts to start the thread that manipulates the Choose File window, the operating system directs the script to the IDE rather than to Ruby. As soon as I changed the association to the Ruby executable, the file_field set method worked happily. (Well, not quite happily... The method still doesn't like spaces in the path name, but that's an easy problem to solve.) I assume that Watir launching a new thread and telling the thread to execute setFileDialog.rb, while what it needs to do is tell the thread to execute setFileDialog.rb *with Ruby*. Either that or people getting this bug need to change the file associations. Michael Ruschena ________________________________ Cain, Mark Thu, 12 Jan 2006 07:32:28 -0800 What behavior do you see? When my script runs I see a Dos window open with focus (just like WinClicker), then the file chooser window open under the Dos window. The Dos window scrolls through all the objects open and finally gets to the File Chooser window, the document name (from $path) appears in the file name field, the open button is clicked and that information is transferred to the file_field text boxes. Finally the submit button is clicked and the file is attached. --Mark ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of chaya shetty Sent: Wednesday, January 11, 2006 10:11 PM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] How can I open and attach fileusingfile_fieldmethod? Hi, I tried as said...Even then I am facing the same problem. Code Used: $path = "C:/Watir/file.txt" $ie.file_field(:name,"srcfile").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.button(:name, "Open").click The file field highlights(yellow)and opens choose file dialog along with another ruby file with contents: # # setFileDialog.rb # # # This file contains the file dialog when it runs as a separate process $LOAD_PATH <&! lt; File.expand_path(File.join(File.dirname(__FILE__), '..')) puts $LOAD_PATH require 'watir/winClicker' filepath = "invalid path passed to setFileDialog.rb" filepath = ARGV[0] unless ARGV[0] == nil clicker= WinClicker.new clicker.setFileRequesterFileName(filepath) clicker = nil Then it waits for me to manually select the file and attach. I have ensured that the path is correct and there is a text file viz. file in the Watir folder. Thanks, Chaya "Cain, Mark" <[EMAIL PROTECTED]> wrote: 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 B! ut 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" <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> 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 _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From zeljko.filipin at gmail.com Thu Jun 1 03:44:39 2006 From: zeljko.filipin at gmail.com (Zeljko Filipin) Date: Thu, 1 Jun 2006 09:44:39 +0200 Subject: [Wtr-general] How can I open and attach file using file_field method? In-Reply-To: <20060601064359.712D4430003@ibsglobalweb.com> References: <20060601064359.712D4430003@ibsglobalweb.com> Message-ID: If you want it fixed, enter a new case at Jira ( http://jira.openqa.org/browse/WTR), so it would not be forgotten. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/0a1957c5/attachment.html From Adrian.Rutter at tnt.com Thu Jun 1 09:55:13 2006 From: Adrian.Rutter at tnt.com (Adrian Rutter) Date: Thu, 1 Jun 2006 14:55:13 +0100 Subject: [Wtr-general] Determine HTML property Message-ID: Hi, I have an HTML field that once saved becomes read-only [readonly="true"]. Apart from doing a regex on the source how can I determine this property? Cheers Aidy --------------------------------------------------------------------------------------------------------------- This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are not the intended recipient you must not copy this message or attachment or disclose the contents to any other person. --------------------------------------------------------------------------------------------------------------- From zeljko.filipin at gmail.com Thu Jun 1 10:09:00 2006 From: zeljko.filipin at gmail.com (Zeljko Filipin) Date: Thu, 1 Jun 2006 16:09:00 +0200 Subject: [Wtr-general] Determine HTML property In-Reply-To: References: Message-ID: ie.radio(:id, "id").readonly? On 6/1/06, Adrian Rutter wrote: > > > Hi, > > I have an HTML field that once saved becomes read-only [readonly="true"]. > Apart from doing a regex on the source how can I determine this property? > > Cheers > > Aidy > > > > > --------------------------------------------------------------------------------------------------------------- > This message and any attachment are confidential and may be privileged or > otherwise protected from disclosure. > If you are not the intended recipient, please telephone or email the > sender and delete this message and any attachment from your system. > If you are not the intended recipient you must not copy this message or > attachment or disclose the contents to any other person. > > --------------------------------------------------------------------------------------------------------------- > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > -- http://www.testingreflections.com/blog/3071 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/74ac64da/attachment.html From bret at pettichord.com Thu Jun 1 10:22:41 2006 From: bret at pettichord.com (Bret Pettichord) Date: Thu, 1 Jun 2006 09:22:41 -0500 Subject: [Wtr-general] How can I open and attach file using file_field method? In-Reply-To: <20060601064359.712D4430003@ibsglobalweb.com> References: <20060601064359.712D4430003@ibsglobalweb.com> Message-ID: Thanks for solving this problem. Now that we have a click_no_wait method, we shouldn't have to resort to external *.rb files in the first place. Bret On 6/1/06, Michael Ruschena wrote: > > I encountered this problem yesterday, and unlike the mail archives, I have > an answer. I was getting exactly the behavior described below: > 1) I would run a script using file_field.set > 2) The script would get to the set method > 3a) the choose file window would be invoked > 3b) the file setFileDialog.rb would be opened in my ruby editor > 3c) the script would sit there waiting for me to take manual action. > 4) As soon as I take manual action to close the window, the script would > resume > Messing around with autoit, and the other suggestions didn't help at all. > > The problem seems to be caused by associating *.rb files with an IDE. When > the set method attempts to start the thread that manipulates the Choose > File > window, the operating system directs the script to the IDE rather than to > Ruby. As soon as I changed the association to the Ruby executable, the > file_field set method worked happily. (Well, not quite happily... The > method > still doesn't like spaces in the path name, but that's an easy problem to > solve.) > > I assume that Watir launching a new thread and telling the thread to > execute > setFileDialog.rb, while what it needs to do is tell the thread to execute > setFileDialog.rb *with Ruby*. Either that or people getting this bug need > to > change the file associations. > > Michael Ruschena > > ________________________________ > > Cain, Mark > Thu, 12 Jan 2006 07:32:28 -0800 > > What behavior do you see? When my script runs I see a Dos window open > with > focus (just like WinClicker), then the file chooser window open under the > Dos window. The Dos window scrolls through all the objects open and > finally > gets to the File Chooser window, the document name (from $path) appears in > the file name field, the open button is clicked and that information is > transferred to the file_field text boxes. Finally the submit button is > clicked and the file is attached. > > > > --Mark > > > > ________________________________ > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of chaya > shetty > Sent: Wednesday, January 11, 2006 10:11 PM > To: wtr-general at rubyforge.org > Subject: Re: [Wtr-general] How can I open and attach > fileusingfile_fieldmethod? > > > > Hi, > > I tried as said...Even then I am facing the same problem. > > Code Used: > > $path = "C:/Watir/file.txt" > > $ie.file_field(:name,"srcfile").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.button(:name, "Open").click > The file field highlights(yellow)and opens choose file dialog along > with > another ruby file with contents: > > # > # setFileDialog.rb > # > # > # This file contains the file dialog when it runs as a separate process > > $LOAD_PATH <&! lt; File.expand_path(File.join(File.dirname(__FILE__), > '..')) > puts $LOAD_PATH > require 'watir/winClicker' > > filepath = "invalid path passed to setFileDialog.rb" > filepath = ARGV[0] unless ARGV[0] == nil > > clicker= WinClicker.new > clicker.setFileRequesterFileName(filepath) > clicker = nil > > > > > Then it waits for me to manually select the file and attach. > > I have ensured that the path is correct and there is a text file viz. file > in the Watir folder. > > > > Thanks, > > Chaya > > > "Cain, Mark" <[EMAIL PROTECTED]> wrote: > > 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 > > > > B! ut 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" <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] [mailto:[EMAIL > PROTECTED] 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 <[EMAIL PROTECTED]> 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 > > _______________________________________________ > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/0ba4cd04/attachment.html From psyonic at gmail.com Thu Jun 1 11:25:14 2006 From: psyonic at gmail.com (Tyler Prete) Date: Thu, 1 Jun 2006 09:25:14 -0600 Subject: [Wtr-general] Methods that can be used within a frame? In-Reply-To: References: <447DE6B1.90209@tower-mt.com> Message-ID: Well I may not even have to deal with it anymore, but how would I change this manually? I do not have control over the HTML in the page, I am only interacting with it via Watir. On 5/31/06, Bret Pettichord wrote: > > On 5/31/06, Tyler Prete wrote: > > > Thank you for the help David. It looks like for now I will just have to > > try and work-around the frame issue... probably won't be too bad. I would > > post some actual code but I am writing this for use with a company intranet, > > so it wouldn't do much good anyway. > > > > What frame issue? If you want to change the page frames that a main page > loads, the way to do that is to change the main page itself. You do all of > this in HTML. I'm not sure i understand what you are trying to do. Are you > trying to do something that you can do manually? > > Bret > > > _______________________________________________ > 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/20060601/60581c80/attachment.html From dara.lillis at kiodex.com Thu Jun 1 11:43:06 2006 From: dara.lillis at kiodex.com (Lillis, Dara) Date: Thu, 1 Jun 2006 08:43:06 -0700 Subject: [Wtr-general] RPC Server unavailable Message-ID: <35AF30C7B5EBFA4DBC854B5B9DF66B0E959F2D@ehost011-27.exch011.intermedia.net> Yesterday I spent a bunch of time getting my watir and ruby versions synchronized on the various machines I use for developing and running tests. I am now using: Ruby 1.8.2-15 Stable Release watir-1.5.1.1017 Is this the right (or at least a "good") Ruby version to use with the latest Watir? I scoured watir.com and the wiki for recommendations on this but couldn't find any. Anway, I am now receiving the "RPC Server unavailable" message intermittently when running tests. I found an old discussion on this (http://rubyforge.org/pipermail/wtr-general/2006-January/004634.html) where Bret recommends: "1. Add time delays between the ie.close and ie.new or ie.start. This will give a chance for the ie.close to really close. 2. Don't close IE -- just reuse the existing client between tests. 3. Create an additional IE. As long as this lives, the IE server will continue to live and you can close and create IE windows without worry. I presume you are using Watir 1.4. The watir library in HEAD uses option 3 to avoid this problem." Am I seeing a different problem since I'm using watir-1.5? Or is it the same thing? If it is the same thing, how do I do #3? Dara Lillis * Software Testing * SunGard * Kiodex * 628 Broadway, Suite 501, New York, NY 10012 Tel 646-437-2627 * Fax 646-437-3910 * http://www.sungard.com/Kiodex -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/57a2dccc/attachment.html From yawl.12545861 at bloglines.com Thu Jun 1 11:54:15 2006 From: yawl.12545861 at bloglines.com (yawl.12545861 at bloglines.com) Date: 1 Jun 2006 15:54:15 -0000 Subject: [Wtr-general] RPC Server unavailable Message-ID: <1149177255.1940079767.24408.sendItem@bloglines.com> > Anway, I am now receiving the "RPC Server unavailable" message > intermittently when running tests. I found an old discussion on this > (http://rubyforge.org/pipermail/wtr-general/2006-January/004634.html) > where Bret recommends: > I am not sure if this will help, but I have seen several people get "RPC Server unavailable" error because they disabled "DCOM Server Process Launcher" service. Please check out my blog for more information: http://seclib.blogspot.com/2005/10/do-not-disable-dcom-server-process.html From bret at pettichord.com Thu Jun 1 12:09:39 2006 From: bret at pettichord.com (Bret Pettichord) Date: Thu, 1 Jun 2006 11:09:39 -0500 Subject: [Wtr-general] RPC Server unavailable In-Reply-To: <35AF30C7B5EBFA4DBC854B5B9DF66B0E959F2D@ehost011-27.exch011.intermedia.net> References: <35AF30C7B5EBFA4DBC854B5B9DF66B0E959F2D@ehost011-27.exch011.intermedia.net> Message-ID: On 6/1/06, Lillis, Dara wrote: > > Yesterday I spent a bunch of time getting my watir and ruby versions > synchronized on the various machines I use for developing and running tests. > I am now using: > > Ruby 1.8.2-15 Stable Release > watir-1.5.1.1017 > > Is this the right (or at least a "good") Ruby version to use with the > latest Watir? I scoured watir.com and the wiki for recommendations on this > but couldn't find any. > That should be fine. Anway, I am now receiving the "RPC Server unavailable" message intermittently when running tests. I found an old discussion on this (* http://rubyforge.org/pipermail/wtr-general/2006-January/004634.html*) where Bret recommends: "1. Add time delays between the ie.close and ie.new or ie.start. This will > give a chance for the ie.close to really close. > 2. Don't close IE -- just reuse the existing client between tests. > 3. Create an additional IE. As long as this lives, the IE server will > continue to live and you can close and create IE windows without worry. > > I presume you are using Watir 1.4. The watir library in HEAD uses option 3 > to avoid this problem." > > Am I seeing a different problem since I'm using watir-1.5? Or is it the > same thing? If it is the same thing, how do I do #3? > Good question. Option 3 was causing problems when it was enabled by default, so i turned it off. You can turn it back on with Watir::IE.persist_ole_connection = true This is an as yet undocumented feature. Please let us know whether this helps. Or whether it creates other problems. I wish i remember the exact problems that lead me to turn it off. Bret -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/c9430b20/attachment.html From EDanilova at NYBOT.com Thu Jun 1 12:33:44 2006 From: EDanilova at NYBOT.com (Danilova, Elza) Date: Thu, 1 Jun 2006 12:33:44 -0400 Subject: [Wtr-general] How to create a script for calendar function? Message-ID: <3111B45C4B9CE54C86294493C8C7E197025DDDDF@mailserver> Hi, Using the following: ie.link(:url,"javascript:show_calendar'resultsearch.gDate')").click ie2=Watir::IE.attach(:title, "Calendar") we were able to open the calendar icon, but could not go any further, because there is no object name on the calendar.html page: -----------Objects in page ------------- name= id= name= id= name= id= name= id= name= id= Calendar html: html> Calendar June 2006
[<<] [<] [Print] [>] [>>]

SunMonTueWedThuFriSat
123
4567 wrote: > Using WATIR I am having problem to create a document that includes the > calendar function. > > How can I drive a java script to execute the calendar function, where > the text field can not be populated with the date and it's only allow > you to select a date by clicking on the calendar icon? > > Thank you, > > Elza > > > "This e-mail and any attachments may contain confidential and > privileged information. Any dissemination or use of the information by > a person other than the intended recipient is unauthorized and may be > illegal. If you are not the intended recipient, please notify the > sender immediately by return e-mail, delete this e-mail and destroy > any copies. Although this e-mail and any attachments are believed to > be free of any virus or other defect that might affect any computer > system into which it is received and opened, it is the responsibility > of the recipient to ensure that it is virus free and no responsibility > is accepted by the Board of Trade of the City of New York, Inc. or the > New York Clearing Corporation for any loss or damage arising in any > way from its use. Thank you." > > > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general The content contained in this electronic message is not intended to constitute formation of a contract binding TWTC. TWTC will be contractually bound only upon execution, by an authorized officer, of a contract including agreed terms and conditions or by express application of its tariffs. This message is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the sender of this E-Mail or by telephone. _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From bret at pettichord.com Thu Jun 1 12:39:41 2006 From: bret at pettichord.com (Bret Pettichord) Date: Thu, 1 Jun 2006 11:39:41 -0500 Subject: [Wtr-general] Methods that can be used within a frame? In-Reply-To: References: <447DE6B1.90209@tower-mt.com> Message-ID: On 6/1/06, Tyler Prete wrote: > > Well I may not even have to deal with it anymore, but how would I change > this manually? I do not have control over the HTML in the page, I am only > interacting with it via Watir. > By design, Watir is a tool for automating things that you can do manually. If you don't know how to do it manually, then Watir is probably the wrong tool for you. Bret -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/1538939a/attachment.html From bret at pettichord.com Thu Jun 1 12:48:10 2006 From: bret at pettichord.com (Bret Pettichord) Date: Thu, 1 Jun 2006 11:48:10 -0500 Subject: [Wtr-general] `method_missing': document (WIN32OLERuntimeError) In-Reply-To: <44740375.1030704@reconnex.net> References: <44740375.1030704@reconnex.net> Message-ID: Please send HTML page and code. On 5/24/06, Manish Sapariya wrote: > > Is this one known? > I searched through the archive and could not find anything similar to > this. > I saw this only first time, and I am not sure whether I will see this > again with the same script. > Please let me know if HTML page or code will help isolate this problem. > > Thanks and Regards, > Manish > > > c:/program > files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1005/./watir.rb:2447:in > `method_missing': document > (WIN32OLERuntimeError) > OLE error code:80070005 in > Access is denied. > > > HRESULT error code:0x80020009 > Exception occurred. from c:/program > files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1005/./watir.rb:2447:in > `document' > from c:/program > files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1005/./watir.rb:1059:in > `check_for_http_error' > from c:/program > files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1005/./watir.rb:205 > from c:/program > files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1005/./watir.rb:203:in > `upto' > from c:/program > files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1005/./watir.rb:203 > from c:/program > files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1005/./watir.rb:201:in > `call' > from c:/program > files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1005/./watir.rb:1558:in > `run_error_checks' > from c:/program > files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1005/./watir.rb:1557:in > `each' > ... 6 levels... > from riGuardSelfTest_2_2_1.rb:374:in `CreateAndScheduleFTPSearch' > from riGuardSelfTest_2_2_1.rb:371:in `each' > from riGuardSelfTest_2_2_1.rb:371:in `CreateAndScheduleFTPSearch' > from riGuardSelfTest_2_2_1.rb:759 > _______________________________________________ > 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/20060601/287b21c3/attachment.html From rodrigo.martin at enratio.com Thu Jun 1 13:41:47 2006 From: rodrigo.martin at enratio.com (Rodrigo Julian Martin) Date: Thu, 1 Jun 2006 14:41:47 -0300 Subject: [Wtr-general] [question] Setting timeout for a ie.wait method? Message-ID: Hello Everybody! I was wondering if there's a way of setting the timeout parameter for the .wait method... I mean, let's say that a page doesn't load in 10 seconds. Could I trap that the .wait method failed after 10 seconds in order to log that? I'm doing this because I need to test if a page has been loaded correctly after clicking a link, maybe there's a easier form of checking this.. Thanks in Advance! Rodrigo Julian Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/31c4204d/attachment.html From christopher.mcmahon at gmail.com Thu Jun 1 13:51:53 2006 From: christopher.mcmahon at gmail.com (Chris McMahon) Date: Thu, 1 Jun 2006 10:51:53 -0700 Subject: [Wtr-general] [question] Setting timeout for a ie.wait method? In-Reply-To: References: Message-ID: <72799cd70606011051k79c9c2aak6a174bfaedde7a8@mail.gmail.com> > I'm doing this because I need to test if a page has been loaded correctly > after clicking a link, maybe there's a easier form of checking this.. > def wait_for_page(seconds) begin @ie.link(:text,"My Incredibly Important Link").click do_the_next_thing_method rescue sleep 1 seconds = seconds + 1 if seconds == 10 puts "waited over 10 seconds for Incredibly Important Link, tried 10 times, exiting" exit end wait_for_page(seconds) #CALL THE SAME METHOD AGAIN end I haven't tested it but it should be OK. -Chris From bret at pettichord.com Thu Jun 1 14:10:05 2006 From: bret at pettichord.com (Bret Pettichord) Date: Thu, 1 Jun 2006 13:10:05 -0500 Subject: [Wtr-general] [question] Setting timeout for a ie.wait method? In-Reply-To: References: Message-ID: On 6/1/06, Rodrigo Julian Martin wrote: > > I was wondering if there's a way of setting the timeout parameter for the > .wait method? I mean, let's say that a page doesn't load in 10 seconds. > Could I trap that the .wait method failed after 10 seconds in order to log > that? > I'm doing this because I need to test if a page has been loaded correctly > after clicking a link, maybe there's a easier form of checking this.. > If all you want to do is verify how long it took to load a page, you can do this: ie.link(:name, "foo").click assert(ie.down_load_time < 10) I have actually been thinking of adding a timeout to the wait method, but i'm not sure your situation really needs it. Bret P.S. I have my doubts about McMahon's suggestion. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/3ca50b9e/attachment.html From christopher.mcmahon at gmail.com Thu Jun 1 14:20:55 2006 From: christopher.mcmahon at gmail.com (Chris McMahon) Date: Thu, 1 Jun 2006 11:20:55 -0700 Subject: [Wtr-general] [question] Setting timeout for a ie.wait method? In-Reply-To: References: Message-ID: <72799cd70606011120y76857381s9d409db9e6e91459@mail.gmail.com> > P.S. I have my doubts about McMahon's suggestion. :) I'm doing something very similar to this in my current Watir scripts right now, except I haven't put in the max-retries logic yet. -Chris From bret at pettichord.com Thu Jun 1 14:49:44 2006 From: bret at pettichord.com (Bret Pettichord) Date: Thu, 1 Jun 2006 13:49:44 -0500 Subject: [Wtr-general] [question] Setting timeout for a ie.wait method? In-Reply-To: <72799cd70606011120y76857381s9d409db9e6e91459@mail.gmail.com> References: <72799cd70606011120y76857381s9d409db9e6e91459@mail.gmail.com> Message-ID: The problem is that link().click won't return until the page is loaded. Maybe you meant to use link().ole_object.click instead? Bret On 6/1/06, Chris McMahon wrote: > > > P.S. I have my doubts about McMahon's suggestion. > > :) > I'm doing something very similar to this in my current Watir scripts > right now, except I haven't put in the max-retries logic yet. > -Chris > _______________________________________________ > Wtr-general mailing list > 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/20060601/26cb9da7/attachment.html From christopher.mcmahon at gmail.com Thu Jun 1 14:55:38 2006 From: christopher.mcmahon at gmail.com (Chris McMahon) Date: Thu, 1 Jun 2006 11:55:38 -0700 Subject: [Wtr-general] [question] Setting timeout for a ie.wait method? In-Reply-To: References: <72799cd70606011120y76857381s9d409db9e6e91459@mail.gmail.com> Message-ID: <72799cd70606011155x5a277255q2a7ebbca4a711a38@mail.gmail.com> On 6/1/06, Bret Pettichord wrote: > The problem is that link().click won't return until the page is loaded. > Maybe you meant to use link().ole_object.click instead? > Ah, you're right, I misunderstood the original question. Rodrigo, in my case, I have interim pages that show messages to the user before the page I need to manipulate arrives. Also, I have pages that have frames, and the frames take longer to load than the outer page does. So I've written these little looping checkers that don't do the next action until the right part of the page is in place. If that's your issue, then my code will work well for you. If you have simple pages that just don't load, then another approach is in order. -Chris From johnc at testdev.net Thu Jun 1 15:22:51 2006 From: johnc at testdev.net (John Castellucci) Date: Thu, 1 Jun 2006 12:22:51 -0700 Subject: [Wtr-general] [question] Setting timeout for a ie.wait method? In-Reply-To: Message-ID: <129501c685b0$c75e1d50$c802a8c0@lewis> I had a similar requirement and addressed it by adding my methods to the Element class. This may not be the best solution, but it worked for me. module Watir class Element def click_wait(how_long = 30) wait_for(how_long) click end def wait_for(how_long=30) 0.upto(how_long-1) do |n| if exists? if enabled? puts "Waited #{n} sec for #{self.class}(:#{@how}, #{@what})" if n > 0 return end end sleep 1 end raise ("#{self.class}(:#{@how}, #{@what}) not found after #{how_long} sec") if ! exists? raise ("#{self.class}(:#{@how}, #{@what}) not enabled after #{how_long} sec") end end end -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/eed323e9/attachment.html From rodrigo.martin at enratio.com Thu Jun 1 16:22:41 2006 From: rodrigo.martin at enratio.com (Rodrigo Julian Martin) Date: Thu, 1 Jun 2006 17:22:41 -0300 Subject: [Wtr-general] [question] Setting timeout for a ie.wait method? Message-ID: Thanks for all your replies... The Chris McMahon answer doesn't fit exactly with what I'm trying to do, but maybe is a good approach... Bret, with the assert sentence, can I say something like... If assert fails, do some code? John, I can't understand your code, I guess I'm too newbie to OO programming...Are you waiting always for 30 seconds? Could this be parametrized too? Thanks again to all of you! ________________________________ From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Bret Pettichord Sent: Jueves, 01 de Junio de 2006 03:50 p.m. To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] [question] Setting timeout for a ie.wait method? The problem is that link().click won't return until the page is loaded. Maybe you meant to use link().ole_object.click instead? Bret On 6/1/06, Chris McMahon wrote: > P.S. I have my doubts about McMahon's suggestion. :) I'm doing something very similar to this in my current Watir scripts right now, except I haven't put in the max-retries logic yet. -Chris _______________________________________________ Wtr-general mailing list 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/20060601/9c2bd723/attachment.html From davids at tower-mt.com Thu Jun 1 16:23:04 2006 From: davids at tower-mt.com (David Schmidt) Date: Thu, 01 Jun 2006 13:23:04 -0700 Subject: [Wtr-general] Methods that can be used within a frame? In-Reply-To: References: <447DE6B1.90209@tower-mt.com> Message-ID: <447F4CA8.6090703@tower-mt.com> Tyler, What I've done in the past is to create a new method, Element#html= which allows you to replace the outerHTML for any element: class Watir::Element def html=(new_html) assert_exists @o.outerHTML = new_html end end Unfortunately, when playing with your top level document that contains the frameset there wasn't any Watir::Element I could grab. I tried doing it manually by taking different document elements on that top page and trying to do the change like: ie.document.body.outerhtml = "test" Even though e.document.body.ole_put_methods shows that we should be able to do this (an outerHTML put call exists) when tried I got the following error: irb(main):029:0> ie.document.body.outerhtml = "test" WIN32OLERuntimeError: OLE error code:800A0258 in htmlfile HRESULT error code:0x80020009 Exception occurred. from (irb):29:in `method_missing' from (irb):29 So in Tyler's case, I was unable to find a way to change the frame element in his top HTML. However, I often use this replacement technique to prevent popups by changing the HTML attributes like this: ie.text_field(:id, 'xxx').html = ie.text_field(:id, 'xxx').html.sub(/ onclick=\S+/, '') which clears out the onclick=... from the element. David Bret Pettichord wrote: > On 6/1/06, *Tyler Prete* > wrote: > > Well I may not even have to deal with it anymore, but how would I > change this manually? I do not have control over the HTML in the > page, I am only interacting with it via Watir. > > > By design, Watir is a tool for automating things that you can do > manually. If you don't know how to do it manually, then Watir is > probably the wrong tool for you. > > Bret > > ------------------------------------------------------------------------ > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general From davids at tower-mt.com Thu Jun 1 16:23:14 2006 From: davids at tower-mt.com (David Schmidt) Date: Thu, 01 Jun 2006 13:23:14 -0700 Subject: [Wtr-general] Determine HTML property In-Reply-To: References: Message-ID: <447F4CB2.6070902@tower-mt.com> Zeljko Filipin wrote: > ie.radio(:id, "id").readonly? > > On 6/1/06, *Adrian Rutter* > wrote: > > > Hi, > > I have an HTML field that once saved becomes read-only > [readonly="true"]. > Apart from doing a regex on the source how can I determine this > property? > > Cheers > > Aidy > I've just encountered a situation where this doesn't work, and written a fix for it, though I'm not sure where this fix would best be integrated. The problem is that while an input element may NOT be read only, a containing element like a table cell, table row or div may have their visibility turned off, which prevents Watir from setting the focus on the input element and effectively makes the input element read only even though the readonly attribute is false: irb(main):014:0> ie.text_field(:id, 'Detail_Date').readonly? => false irb(main):015:0> ie.text_field(:id, 'Detail_Date').set('01/01/2000') WIN32OLERuntimeError: focus OLE error code:800A083E in htmlfile Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus. HRESULT error code:0x80020009 Exception occurred. from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1010/./watir.rb:3871:in `method_missing' from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.0.1010/./watir.rb:3871:in `set' from (irb):15 In this case, a TR element a few levels higher has a style of "visibility: hidden; display: none" so the control is invisible and thus read only. I see a few solutions. The first would be to try to update the input element and then rescue the WIN32OLERuntimeError exception. I'm not particularly fond of this, especially since the exception isn't an exception specific to this problem. Another option is to iterate up the DOM elements checking every element to make sure that is is visible. This could be done in Element#readonly?, but then we wouldn't be able to see the value of the actual readonly attribute. I chose to implement another method which I called "writable?" which first checks that the element exists, is enabled and not readonly and then moves up the DOM tree and reports false if any element is not visible (visibility != 'hidden' and display != 'none'). I've tested this and while it can be slow if the input element is deeply embedded it *does* seem to be accurate: irb(main):016:0> ie.text_field(:id, 'Detail_Date').writable? => false irb(main):017:0> ie.text_field(:id, 'Detail_DOB').writable? => true You can try this by adding the following method in your Watir script or by adding just the writable? definition inside class Element in Watir.rb. I can add this to trunk once I get some tests written to test it if we decide this is the way to go. Does anyone have a cleaner or faster way to do this? module Watir class Element # Determine if we can write to a DOM element. # If any parent element isn't visible then we cannot write to the # element. The only realiable way to determine this is to iterate # up the DOM elemint tree checking every element to make sure it's # visible. def writable? assert_exists # First make sure the element itself is writable begin assert_enabled assert_not_readonly rescue Watir::Exception::ObjectDisabledException, Watir::Exception::ObjectReadOnlyException return false end return false if ! document.iscontentEditable # Now iterate up the DOM element tree and return false if any # parent element isn't visible or is disabled. object = document while object begin if object.style.invoke('visibility') =~ /^hidden$/i return false end if object.style.invoke('display') =~ /^none$/i return false end if object.invoke('isDisabled') return false end rescue WIN32OLERuntimeError end object += '.parentElement' end true end end end From psyonic at gmail.com Thu Jun 1 16:33:47 2006 From: psyonic at gmail.com (Tyler Prete) Date: Thu, 1 Jun 2006 14:33:47 -0600 Subject: [Wtr-general] Methods that can be used within a frame? In-Reply-To: References: <447DE6B1.90209@tower-mt.com> Message-ID: Bret, I think we are having some syntactic problems. I CAN do it manually, by interacting with the page myself. I'll try and explain the situation since I can't actually give an example. I am working with a customer service app that has multiple frames, a search bar on the left, a customer frame in the top right, and an invoice frame in the top left. When a search is issued that can result in multiple people, a popup window is opened containing all the names of possible customers. When a name is selected, the customer frame is supposed to change to show that specific customer. When I go through the process myself, it works. However, when using watir, I can click on the link, but it does not load the customer info in the customer frame. I could not get it to work directly, so my idea was to take the link URL and load it manually in the frame, but apparently this is not possible, at least not at this time. Hopefully that helps clear things up. --Tyler On 6/1/06, Bret Pettichord wrote: > > On 6/1/06, Tyler Prete wrote: > > > Well I may not even have to deal with it anymore, but how would I change > > this manually? I do not have control over the HTML in the page, I am only > > interacting with it via Watir. > > > > By design, Watir is a tool for automating things that you can do manually. > If you don't know how to do it manually, then Watir is probably the wrong > tool for you. > > Bret > > > _______________________________________________ > Wtr-general mailing list > 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/20060601/5e84241a/attachment.html From bret at pettichord.com Thu Jun 1 16:47:32 2006 From: bret at pettichord.com (Bret Pettichord) Date: Thu, 1 Jun 2006 15:47:32 -0500 Subject: [Wtr-general] Methods that can be used within a frame? In-Reply-To: References: <447DE6B1.90209@tower-mt.com> Message-ID: On 6/1/06, Tyler Prete wrote: > > When I go through the process myself, it works. However, when using > watir, I can click on the link, but it does not load the customer info in > the customer frame. > This is the problem we should focus on. Can you provide more information? Are you getting an error message? Can you show us any code or html? -- feel free to sanitize. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/b5b64e09/attachment.html From Bill.Attebery at twtelecom.com Thu Jun 1 18:05:38 2006 From: Bill.Attebery at twtelecom.com (Attebery, Bill) Date: Thu, 1 Jun 2006 16:05:38 -0600 Subject: [Wtr-general] How to create a script for calendar function? Message-ID: Try ie2.show_links to see all the links in the page and ie2.show_tables to see all the tables in the page Looking at the code snippet -- ie2.link(:text, '2').click should set the date to '2006-06-02' ie2.link(:id, ).click should set the date to '2006-06-02' Ie2.table(:index, 2)[2][6].click should set the date to '2006-06-02' ie2.table(:index, )[2][6].fireEvent('onclick') should also set the date to '2006-06-02' Also ie2.link(:text, '<<').click should move the year back ie2.link(:text, '>>').click should move the year forward ie2.link(:text, '>').click should move the month forward ie2.link(:text, 'Print').click should print (I assume) etc. Likewise ie2.table(:index, 1)[1][1].click will move the year back ie2.table(:index, 1)[1][1].fireEvent will move the year back etc. I recommend identifying the links by :text (simple to code and read) -- but there are many other ways to do the same thing. Hope this helps. -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Danilova, Elza Sent: Thursday, June 01, 2006 10:34 AM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] How to create a script for calendar function? Hi, Using the following: ie.link(:url,"javascript:show_calendar'resultsearch.gDate')").click ie2=Watir::IE.attach(:title, "Calendar") we were able to open the calendar icon, but could not go any further, because there is no object name on the calendar.html page: -----------Objects in page ------------- name= id= name= id= name= id= name= id= name= id= Calendar html: html> Calendar June 2006
[<<] [<] [Print] [>] [>>]

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

SunMonTueWedThuFriSat
123
4567
-----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Attebery, Bill Sent: Wednesday, May 31, 2006 6:10 PM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] How to create a script for calendar function? Not sure if all calendar functions are created equal -- the one used at my site pops up another IE window -- I can attach to it and then drive it like always. ie.image(:id, 'my_calendar_icon').click @ie2=IE.attach(:title, /Select Date/) Now @ie2 is another browser instance with select_lists, links, buttons, etc. available to control through regular watir statements. @ie2.select_list(:name, 'cboMonth').select('Jun') @ie2.select_list(:name, 'cboYear').select('2006') @ie2.link(:text, '15').click -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of John Fitisoff Sent: Wednesday, May 31, 2006 3:28 PM To: wtr-general at rubyforge.org Subject: Re: [Wtr-general] How to create a script for calendar function? If you aren't trying to do anything complicated - and the calendar control responds to keyboard input - you might want to try using the send_keys method to set the calendar control: ie.image(:id, "my_calendar_icon").click ie.send_keys("{UP}") ie.send_keys("{LEFT}") ie.send_keys("{ENTER}") The drawback is that this approach may not let you exercise all of the calendar control's functionality. But if you're just worried about setting a date it's probably enough to get you past the control without worrying about the Javascript. --- "Danilova, Elza" wrote: > Using WATIR I am having problem to create a document that includes the > calendar function. > > How can I drive a java script to execute the calendar function, where > the text field can not be populated with the date and it's only allow > you to select a date by clicking on the calendar icon? > > Thank you, > > Elza > > > "This e-mail and any attachments may contain confidential and > privileged information. Any dissemination or use of the information by > a person other than the intended recipient is unauthorized and may be > illegal. If you are not the intended recipient, please notify the > sender immediately by return e-mail, delete this e-mail and destroy > any copies. Although this e-mail and any attachments are believed to > be free of any virus or other defect that might affect any computer > system into which it is received and opened, it is the responsibility > of the recipient to ensure that it is virus free and no responsibility > is accepted by the Board of Trade of the City of New York, Inc. or the > New York Clearing Corporation for any loss or damage arising in any > way from its use. Thank you." > > > > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general The content contained in this electronic message is not intended to constitute formation of a contract binding TWTC. TWTC will be contractually bound only upon execution, by an authorized officer, of a contract including agreed terms and conditions or by express application of its tariffs. This message is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the sender of this E-Mail or by telephone. _______________________________________________ Wtr-general mailing list 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 The content contained in this electronic message is not intended to constitute formation of a contract binding TWTC. TWTC will be contractually bound only upon execution, by an authorized officer, of a contract including agreed terms and conditions or by express application of its tariffs. This message is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the sender of this E-Mail or by telephone. _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general The content contained in this electronic message is not intended to constitute formation of a contract binding TWTC. TWTC will be contractually bound only upon execution, by an authorized officer, of a contract including agreed terms and conditions or by express application of its tariffs. This message is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the sender of this E-Mail or by telephone. From psyonic at gmail.com Thu Jun 1 18:35:08 2006 From: psyonic at gmail.com (Tyler Prete) Date: Thu, 1 Jun 2006 16:35:08 -0600 Subject: [Wtr-general] Methods that can be used within a frame? In-Reply-To: References: <447DE6B1.90209@tower-mt.com> Message-ID: I can't provide the full html because I don't have access to it, but here is the link I am trying to click from the popup:
8560113 I imagine part of the problem is related to the onclick javascript event, however I did try calling it seperately with no success. On 6/1/06, Bret Pettichord wrote: > > On 6/1/06, Tyler Prete wrote: > > > When I go through the process myself, it works. However, when using > > watir, I can click on the link, but it does not load the customer info in > > the customer frame. > > > > This is the problem we should focus on. Can you provide more information? > Are you getting an error message? Can you show us any code or html? -- feel > free to sanitize. > > > _______________________________________________ > 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/20060601/47e006bb/attachment.html From lonny at titanez.net Thu Jun 1 19:36:18 2006 From: lonny at titanez.net (Lonny Eachus) Date: Thu, 01 Jun 2006 16:36:18 -0700 Subject: [Wtr-general] How to create a script for calendar function? In-Reply-To: References: Message-ID: <447F79F2.4010508@titanez.net> *IF* (this is a big if, because I am not familiar with the calendar thing) the elements are in a predicable pattern on the page, then here is a possible avenue of approach: You could access the elements by index, and use the "html=" method of David's to give them names or IDs. Then access as usual . . . Lonny Eachus ========= > -----Original Message----- > From: wtr-general-bounces at rubyforge.org > [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Danilova, Elza > Sent: Thursday, June 01, 2006 10:34 AM > To: wtr-general at rubyforge.org > Subject: Re: [Wtr-general] How to create a script for calendar function? > > Hi, > > Using the following: > ie.link(:url,"javascript:show_calendar'resultsearch.gDate')").click > ie2=Watir::IE.attach(:title, "Calendar") we were able to open the > calendar icon, but could not go any further, because there is no object > name on the calendar.html page: > > -----------Objects in page ------------- > name= id= > name= id= > name= id= > name= id= > name= id= > > > Calendar html: > > > html> > Calendar > > FACE='Verdana' SIZE=2>June 2006
BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'>
ALIGN=center> [ HREF="javascript:window.opener.Build('resultsearch.gDate', '5', '2005', > 'MONTH DD, YYYY');"><<] [ HREF="javascript:window.opener.Build('resultsearch.gDate', '4', '2006', > 'MONTH DD, YYYY');"><] [ HREF="javascript:window.print();">Print] [ HREF="javascript:window.opener.Build('resultsearch.gDate', '6', '2006', > 'MONTH DD, YYYY');">>] [ HREF="javascript:window.opener.Build('resultsearch.gDate', '5', '2007', > 'MONTH DD, YYYY');">>>]

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

>
FACE='Verdana' COLOR='darkgreen'>Sun WIDTH='14%'> COLOR='darkgreen'>Mon FACE='Verdana' COLOR='darkgreen'>Tue WIDTH='14%'> COLOR='darkgreen'>Wed FACE='Verdana' COLOR='darkgreen'>Thu WIDTH='14%'> COLOR='darkgreen'>Fri FACE='Verdana' COLOR='darkgreen'>Sat
WIDTH='14%' BGCOLOR="#e0e0e0"> > > > > onClick="self.opener.document.resultsearch.gDate.value='2006-06-01';wind > ow.close();">1 WIDTH='14%'> onClick="self.opener.document.resultsearch.gDate.value='2006-06-02';wind > ow.close();">2 SIZE='2' FACE='Verdana'> onClick="self.opener.document.resultsearch.graDate.value='2006-06-03';wi > ndow.close();">3
BGCOLOR="#e0e0e0"> onClick="self.opener.document.resultsearch.gDate.value='2006-06-04';wind > ow.close();">4 FACE='Verdana'> onClick="self.opener.document.resultsearch.gDate.value='2006-06-05';wind > ow.close();">5 FACE='Verdana'> onClick="self.opener.document.resultsearch.gDate.value='2006-06-06';wind > ow.close();">6 FACE='Verdana'> onClick="self.opener.document.resultsearch.gDate.value='2006-06-07';wind > ow.close();">7
> > > -----Original Message----- > From: wtr-general-bounces at rubyforge.org > [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Attebery, Bill > Sent: Wednesday, May 31, 2006 6:10 PM > To: wtr-general at rubyforge.org > Subject: Re: [Wtr-general] How to create a script for calendar function? > > > > Not sure if all calendar functions are created equal -- the one used at > my site pops up another IE window -- I can attach to it and then drive > it like always. > > ie.image(:id, 'my_calendar_icon').click > @ie2=IE.attach(:title, /Select Date/) > > Now @ie2 is another browser instance with select_lists, links, buttons, > etc. available to control through regular watir statements. > > @ie2.select_list(:name, 'cboMonth').select('Jun') > @ie2.select_list(:name, 'cboYear').select('2006') > @ie2.link(:text, '15').click > > -----Original Message----- > From: wtr-general-bounces at rubyforge.org > [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of John Fitisoff > Sent: Wednesday, May 31, 2006 3:28 PM > To: wtr-general at rubyforge.org > Subject: Re: [Wtr-general] How to create a script for calendar function? > > If you aren't trying to do anything complicated - and the calendar > control responds to keyboard input - you might want to try using the > send_keys method to set the calendar control: > > ie.image(:id, "my_calendar_icon").click > ie.send_keys("{UP}") > ie.send_keys("{LEFT}") > ie.send_keys("{ENTER}") > > The drawback is that this approach may not let you exercise all of the > calendar control's functionality. But if you're just worried about > setting a date it's probably enough to get you past the control without > worrying about the Javascript. > > --- "Danilova, Elza" wrote: > > > Using WATIR I am having problem to create a document that includes the > > > calendar function. > > > > How can I drive a java script to execute the calendar function, where > > the text field can not be populated with the date and it's only allow > > you to select a date by clicking on the calendar icon? > > > > Thank you, > > > > Elza > > > > > > "This e-mail and any attachments may contain confidential and > > privileged information. Any dissemination or use of the information by > > > a person other than the intended recipient is unauthorized and may be > > illegal. If you are not the intended recipient, please notify the > > sender immediately by return e-mail, delete this e-mail and destroy > > any copies. Although this e-mail and any attachments are believed to > > be free of any virus or other defect that might affect any computer > > system into which it is received and opened, it is the responsibility > > of the recipient to ensure that it is virus free and no responsibility > > > is accepted by the Board of Trade of the City of New York, Inc. or the > > > New York Clearing Corporation for any loss or damage arising in any > > way from its use. Thank you." > > > > > > > > > _______________________________________________ > > Wtr-general mailing list > > Wtr-general at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wtr-general > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > > > > The content contained in this electronic message is not intended to > constitute formation of a contract binding TWTC. TWTC will be > contractually bound only upon execution, by an authorized officer, of a > contract including agreed terms and conditions or by express application > of its tariffs. > > This message is intended only for the use of the individual or entity to > which it is addressed. If the reader of this message is not the intended > recipient, or the employee or agent responsible for delivering the > message to the intended recipient, you are hereby notified that any > dissemination, distribution or copying of this message is strictly > prohibited. If you have received this communication in error, please > notify us immediately by replying to the sender of this E-Mail or by > telephone. _______________________________________________ > Wtr-general mailing list > 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 > > > > The content contained in this electronic message is not intended to > constitute formation of a contract binding TWTC. TWTC will be > contractually bound only upon execution, by an authorized officer, of > a contract including agreed terms and conditions or by express > application of its tariffs. > > This message is intended only for the use of the individual or entity > to which it is addressed. If the reader of this message is not the > intended recipient, or the employee or agent responsible for > delivering the message to the intended recipient, you are hereby > notified that any dissemination, distribution or copying of this > message is strictly prohibited. If you have received this > communication in error, please notify us immediately by replying to > the sender of this E-Mail or by telephone. > > > ------------------------------ > > _______________________________________________ > Wtr-general mailing list > Wtr-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > > End of Wtr-general Digest, Vol 31, Issue 5 > ****************************************** > From Adrian.Rutter at tnt.com Fri Jun 2 12:42:46 2006 From: Adrian.Rutter at tnt.com (Adrian Rutter) Date: Fri, 2 Jun 2006 17:42:46 +0100 Subject: [Wtr-general] organising the app map Message-ID: Hi, Could I have some opinions on whether this is a good way to organise my app map? object_map.rb module Constants URL = "http://portal" USER_NAME = "aidy" #at some time this will be var PASSWORD = "12345" # " " end class LoginWin USER_NAME ='userid' LOG_IN_LINK = 'Log in' PASSWORD = 'password' LOG_IN_BTN= 'Log in' end class MainWin ..... end logob.rb require 'objectMap' def login (username, password) @ie.link(:text, LoginWin::LOG_IN_LINK).click @ie.text_field(:name, LoginWin::USER_NAME).set(username) @ie.text_field(:name, LoginWin::PASSWORD).set(password) @ie.button(:value,LoginWin::LOG_IN_BTN).click end test_1.rb require 'objectMap' require 'browser' require 'logon' start_browser(Constants::URL) login(Constants::USER_NAME, Constants::PASSWORD) Cheers Aidy --------------------------------------------------------------------------------------------------------------- This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are not the intended recipient you must not copy this message or attachment or disclose the contents to any other person. --------------------------------------------------------------------------------------------------------------- From Lonny at TitanEZ.net Sat Jun 3 12:31:31 2006 From: Lonny at TitanEZ.net (Lonny Eachus) Date: Sat, 03 Jun 2006 09:31:31 -0700 Subject: [Wtr-general] Quoting previous messages In-Reply-To: References: Message-ID: <4481B963.6080405@TitanEZ.net> Folks, I have to ask again: PLEASE trim what you include in your replies. Somebody recently echoed an entire digest . . . it was included in the next digest. This makes it tedious to follow what is going on, and hard to separate what is being stated THIS time from what has gone before. Others who subscribe to the list can see the emails that have already been sent. There is no need to quote long chunks of code or prior threads of conversation in your emails. Please take a moment to trim most of the echoed material from your replies before you send. That will make for a more pleasant experience for everybody. Lonny Eachus ========== From noreply at rubyforge.org Sun Jun 4 15:18:41 2006 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 4 Jun 2006 15:18:41 -0400 (EDT) Subject: [Wtr-general] [ wtr-Support Requests-4654 ] Test, test Message-ID: <20060604191841.7D6AB3CC233@rubyforge.org> Support Requests item #4654, was opened at 2006-06-04 19:18 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=488&aid=4654&group_id=104 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Tom Copeland (tom) Assigned to: Nobody (None) Summary: Test, test Initial Comment: Just testing the "tracker to email list" feature... tom ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=488&aid=4654&group_id=104 From zeljko.filipin at gmail.com Mon Jun 5 04:09:12 2006 From: zeljko.filipin at gmail.com (Zeljko Filipin) Date: Mon, 5 Jun 2006 10:09:12 +0200 Subject: [Wtr-general] Quoting previous messages In-Reply-To: <4481B963.6080405@TitanEZ.net> References: <4481B963.6080405@TitanEZ.net> Message-ID: +1 On 6/3/06, Lonny Eachus wrote: > > Folks, I have to ask again: PLEASE trim what you include in your > replies. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060605/31e9c256/attachment.html From nerimarco at hotmail.com Mon Jun 5 04:50:49 2006 From: nerimarco at hotmail.com (Marco Neri) Date: Mon, 5 Jun 2006 18:50:49 +1000 Subject: [Wtr-general] xpath - which html checker to use? Message-ID: I'm using watir 1.5.1.1017 rexml 3.1.4 ( I have not copied any files out of this distrubution ) I'm trying to use an xpath query in a test and I'm running into a parse error ( here's incomplete trace ). 1) Error: test_rexmltest(TC_rexmltest): REXML::ParseException: #
\n\n" htmlSource = html_source(document.body,htmlSource," ") htmlSource += "\n\n" My problem has 2 parts. 1. why is div="test" written into the output yet when I check the original src in the browser there is no tag div="test". 2. If I modify the watir.rb src and bypass the call to (document.body,htmlSource," ") by using a diff call (ie.ie.parent.document.body OR i use a filestream to read in a saved copy of the html src for the page ) I don't have the div="test' error but I still end up with other parse errors. I know these must be down to malformed html. but.. when I run the original src html through either HTML tidy or Simpletidy it reports warnings but not errors. The parser in rexml must be more strict? Which validator should I use to independently verify the html so that it's inline with what rexml parser expects? thanks Marco -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060605/a9b7efa4/attachment.html From angrez at gmail.com Mon Jun 5 08:39:13 2006 From: angrez at gmail.com (Angrez Singh) Date: Mon, 5 Jun 2006 18:09:13 +0530 Subject: [Wtr-general] xpath - which html checker to use? In-Reply-To: References: Message-ID: Hi Marco, Could you please send the HTML source so that we can have more detalied look into it? Regards, Angrez On 6/5/06, Marco Neri wrote: > > I'm using watir 1.5.1.1017 > rexml 3.1.4 ( I have not copied any files out of this distrubution ) > > I'm trying to use an xpath query in a test and I'm running into a parse > error ( here's incomplete trace ). > > > 1) Error: > test_rexmltest(TC_rexmltest): > REXML::ParseException: # start > Line: > Position: > Last 80 unconsumed characters: >
the output of the call to html_source(document.body,htmlSource," ") in > function create_rexml_document_object in watir.rb > htmlSource =" encoding=\"us-ascii\"?>\n\n" > htmlSource = html_source(document.body,htmlSource," ") > htmlSource += "\n\n" > > My problem has 2 parts. > 1. why is div="test" written into the output yet when I check the original > src in the browser there is no tag div="test". > 2. If I modify the watir.rb src and bypass the call to (document.body,htmlSource," > ") by using a diff call (ie.ie.parent.document.body OR i use a filestream > to read in a saved copy of the html src for the page ) I don't have the > div="test' error but I still end up with other parse errors. I know these > must be down to malformed html. but.. > > when I run the original src html through either HTML tidy or Simpletidy it > reports warnings but not errors. The parser in rexml must be more > strict? Which validator should I use to independently verify the html so > that it's inline with what rexml parser expects? > > thanks > > Marco > > > > > _______________________________________________ > 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/20060605/02395ebb/attachment.html From stuporglue at gmail.com Mon Jun 5 18:27:57 2006 From: stuporglue at gmail.com (Michael Moore) Date: Mon, 5 Jun 2006 16:27:57 -0600 Subject: [Wtr-general] Beep for intervention? Message-ID: I've got a script that can take some time to run, and needs human intervention in a couple parts. Is there a way to have Watir beep or make some sort of audio notification? I guess I could make a page that plays a MIDI file or something which would get opened up at a certain point in the code, but something cleaner would be nice. Thanks, -- Michael Moore ------------------------------- www.stuporglue.org -- Donate your used computer to a student that needs it. www.ubuntu-utah.org -- In Utah? Interested in Ubuntu? Come join us. From mtownley at firstlook.biz Mon Jun 5 18:35:32 2006 From: mtownley at firstlook.biz (Mike Townley) Date: Mon, 5 Jun 2006 17:35:32 -0500 Subject: [Wtr-general] Beep for intervention? Message-ID: <91E302EA72562F43AEDC06DD8FAE7D364C2714@ord1mail01.firstlook.biz> You can't do that with Watir, but you can with ruby in general. Remember that you are not limited by Watir to what you can do in your test scripts. Your upper limit is with Ruby. You can program a notification in ruby when it gets to a specific part of your script. Maybe you would like it to open an alert box or play a sound or something like that? You can find code in the libraries on how to do nifty things like this. Best Wishes Mike -----Original Message----- From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Michael Moore Sent: Monday, June 05, 2006 5:28 PM To: wtr-general at rubyforge.org Subject: [Wtr-general] Beep for intervention? I've got a script that can take some time to run, and needs human intervention in a couple parts. Is there a way to have Watir beep or make some sort of audio notification? I guess I could make a page that plays a MIDI file or something which would get opened up at a certain point in the code, but something cleaner would be nice. Thanks, -- Michael Moore ------------------------------- www.stuporglue.org -- Donate your used computer to a student that needs it. www.ubuntu-utah.org -- In Utah? Interested in Ubuntu? Come join us. _______________________________________________ Wtr-general mailing list Wtr-general at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general From christopher.mcmahon at gmail.com Mon Jun 5 18:39:19 2006 From: christopher.mcmahon at gmail.com (Chris McMahon) Date: Mon, 5 Jun 2006 15:39:19 -0700 Subject: [Wtr-general] Beep for intervention? In-Reply-To: References: Message-ID: <72799cd70606051539icc3dc40h29a97c6d58dc8bd6@mail.gmail.com> On 6/5/06, Michael Moore wrote: > I've got a script that can take some time to run, and needs human > intervention in a couple parts. Is there a way to have Watir beep or > make some sort of audio notification? print "\a" Don't tell anybody I told you. :) -Chris From stuporglue at gmail.com Mon Jun 5 18:50:52 2006 From: stuporglue at gmail.com (Michael Moore) Date: Mon, 5 Jun 2006 16:50:52 -0600 Subject: [Wtr-general] Beep for intervention? In-Reply-To: <91E302EA72562F43AEDC06DD8FAE7D364C2714@ord1mail01.firstlook.biz> References: <91E302EA72562F43AEDC06DD8FAE7D364C2714@ord1mail01.firstlook.biz> Message-ID: > You can't do that with Watir, but you can with ruby in general. Remember > that you are not limited by Watir to what you can do