Howdy again. I have written a script that successfully logs different aspects of a very simple web test. I have it set up to create a log directory structure depending on the Project name, test being performed, and date (all variables). I would like to separate the general logging code so that I can use it in other tests. This is, however giving me some trouble.
You can download the coded sample here: http://www.makeharmony.com/watir.html Essentially what I'd like to do is tear the Logger section out of that script and call it logger.rb, make the variables global with $, and placed require 'logger' in the test script. This, however, doesn't work so well. What do I need to do? Thanks, Adam PS - You'll notice some WET code in there as well -- I was never able to get Watir JS pop-up handling solved, so I tried out the WET code instead. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, July 21, 2006 11:35 PM To: [email protected] Subject: Wtr-general Digest, Vol 32, Issue 34 Send Wtr-general mailing list submissions to [email protected] To subscribe or unsubscribe via the World Wide Web, visit http://rubyforge.org/mailman/listinfo/wtr-general or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of Wtr-general digest..." Today's Topics: 1. how to disable image loading (Xavier Noria) 2. Re: how to disable image loading (Charley Baker) 3. Re: Setting a timeout on ie.goto()? (Charley Baker) 4. Re: Setting a timeout on ie.goto()? (John Fitisoff) 5. Re: Setting a timeout on ie.goto()? (John Krystynak) 6. Proxy server login (Simo, Ben) 7. problem in click event of "div" (VIKASH KUMAR) ---------------------------------------------------------------------- Message: 1 Date: Fri, 21 Jul 2006 23:47:29 +0200 From: Xavier Noria <[EMAIL PROTECTED]> Subject: [Wtr-general] how to disable image loading To: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=US-ASCII; format=flowed Is there a way to disable image loading programmatically? -- fxn ------------------------------ Message: 2 Date: Fri, 21 Jul 2006 16:16:06 -0600 From: "Charley Baker" <[EMAIL PROTECTED]> Subject: Re: [Wtr-general] how to disable image loading To: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" You could use AutoIt to disable image loading in ie. Take a look at WindowHelper.rb(part of the watir distribution and uses AutoIt) as well as the AutoIt site at: http://www.hiddensoft.com/AutoIt/ -Charley On 7/21/06, Xavier Noria <[EMAIL PROTECTED]> wrote: > > Is there a way to disable image loading programmatically? > > -- fxn > > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060721/973a2481 /attachment-0001.html ------------------------------ Message: 3 Date: Fri, 21 Jul 2006 16:18:07 -0600 From: "Charley Baker" <[EMAIL PROTECTED]> Subject: Re: [Wtr-general] Setting a timeout on ie.goto()? To: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" Hey Steve, Honestly that sounds like a defect. That being said, there is no simple way that I currently know of to get around waiting for ie to return a ready state. -Charley On 7/21/06, Steve Tangsombatvisit <[EMAIL PROTECTED]> wrote: > > Hi folks, > > Relatively new to using Ruby/Watir... I have a quick question about > the ie.goto statement, is there a way to set a timeout for this call > so that if the webpage does not complete loading with X amount of > seconds the call terminates? > > The problem we're running into is that some of the pages we access > occasionally NEVER finish loading. On the IE status bar (bottom left) > we'll see a message that says "Opening Page XXXX" or " (1 Item > Remaining) Opening Page XXXXX" and that message will persist forever (as far as we can tell)... > So our scripts are hanging at the ie.goto call cause the page never > loads completely. > > Any tips you guys can give me? > > Thanks, > Steve > > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060721/6f361740 /attachment-0001.html ------------------------------ Message: 4 Date: Fri, 21 Jul 2006 15:25:55 -0700 (PDT) From: John Fitisoff <[EMAIL PROTECTED]> Subject: Re: [Wtr-general] Setting a timeout on ie.goto()? To: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=iso-8859-1 <<The problem we're running into is that some of the pages we access occasionally NEVER finish loading.>> Yup. I'm working on multithreaded tests and that seems to happen (not a lot, but then it doesn't have to happen a lot to mess things up). You can use Ruby's timeout library to set a timeout value for an action or series of actions and then rescue the timeout exception when it occurs. something like the example below should work. But someone else out there may have a simpler way of dealing with it. ---------------------------- require 'watir' require 'timeout' include Watir ie = IE.new def timeout begin timeout(120.0) do |timeout_length| ie.goto("www.yoursite.com") end rescue Timeout::Error => e puts e ie.close end end --- Steve Tangsombatvisit <[EMAIL PROTECTED]> wrote: > Hi folks, > > Relatively new to using Ruby/Watir... I have a quick question about > the ie.goto statement, is there a way to set a timeout for this call > so that if the webpage does not complete loading with X amount of > seconds the call terminates? > > The problem we're running into is that some of the pages we access > occasionally NEVER finish loading. > On the IE status bar (bottom left) we'll see a message that says > "Opening Page XXXX" or " (1 Item > Remaining) Opening Page XXXXX" and that message will persist forever > (as far as we can tell)... So our scripts are hanging at the ie.goto > call cause the page never loads completely. > > Any tips you guys can give me? > > Thanks, > Steve> _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------ Message: 5 Date: Fri, 21 Jul 2006 16:59:47 -0700 From: "John Krystynak" <[EMAIL PROTECTED]> Subject: Re: [Wtr-general] Setting a timeout on ie.goto()? To: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed I have a similar problem - that program that does a ie.link().click that brings up a File Save Dialog never resumes. I've tried threads, and system calls to run the Autoit stuff, but the only way I can automatically fill in the File Save Dialog is to run a separate autoit ruby program from the command line. Then after autoit fills in the dialog, and the file is saved, the original ruby program that got to that point is hung, still on the ie.link().click. It never resumes once the dialog is gone. It's really frustrating. johnk On 7/21/06, John Fitisoff <[EMAIL PROTECTED]> wrote: > <<The problem we're running into is that some of the > pages we access occasionally NEVER finish loading.>> > > Yup. I'm working on multithreaded tests and that seems > to happen (not a lot, but then it doesn't have to > happen a lot to mess things up). You can use Ruby's > timeout library to set a timeout value for an action > or series of actions and then rescue the timeout > exception when it occurs. something like the example > below should work. But someone else out there may have > a simpler way of dealing with it. > ---------------------------- > > require 'watir' > require 'timeout' > include Watir > > ie = IE.new > > def timeout > begin > timeout(120.0) do |timeout_length| > ie.goto("www.yoursite.com") > end > rescue Timeout::Error => e > puts e > ie.close > end > end > > > > --- Steve Tangsombatvisit <[EMAIL PROTECTED]> wrote: > > > Hi folks, > > > > Relatively new to using Ruby/Watir... I have a > > quick question about the ie.goto statement, is there > > a way to set a timeout for this call so that if the > > webpage does not complete loading with X amount of > > seconds the call terminates? > > > > The problem we're running into is that some of the > > pages we access occasionally NEVER finish loading. > > On the IE status bar (bottom left) we'll see a > > message that says "Opening Page XXXX" or " (1 Item > > Remaining) Opening Page XXXXX" and that message will > > persist forever (as far as we can tell)... So our > > scripts are hanging at the ie.goto call cause the > > page never loads completely. > > > > Any tips you guys can give me? > > > > Thanks, > > Steve> > _______________________________________________ > > Wtr-general mailing list > > [email protected] > > http://rubyforge.org/mailman/listinfo/wtr-general > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > -- Compare New & Used Networking Equipment http://routercomp.com ------------------------------ Message: 6 Date: Fri, 21 Jul 2006 21:39:10 -0600 From: "Simo, Ben" <[EMAIL PROTECTED]> Subject: [Wtr-general] Proxy server login To: <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" I am trying to use WATIR through a proxy server. The browser is configured to automatically detect proxy settings and to use a configuration script. When manually browsing in IE, the browser displays a proxy login dialog when I attempt to access a site that is outside our network. This proxy login dialog may show up when the browser is opened, or it may show up later. When I start IE via WATIR, no proxy login dialog is displayed and IE displays the "Cannot find server" error page. How can I get WATIR to start IE so that it will detect the need to login to the proxy server, and how do I get it to log into the proxy server? Thank you, Ben J. Benjamin Simo Senior Quality Assurance Engineer Standard & Poor's The McGraw-Hill Companies 7400 S. Alton Ct. Centennial, CO 80112 [EMAIL PROTECTED] (303) 721-4606 -------------------------------------------------------- The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. -------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060721/71ff6251 /attachment-0001.html ------------------------------ Message: 7 Date: Sat, 22 Jul 2006 05:34:46 +0100 (BST) From: VIKASH KUMAR <[EMAIL PROTECTED]> Subject: [Wtr-general] problem in click event of "div" To: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" Sir, How to focus on "div" element & click on that element. I am using HTML having source: <div id="tCt1" dojoType="ContentPane" label="Billing" style="width: 760px;"> <div class="permissionList"> <label class="chk" for="assignedSystemGroups_2_1"> <input type="checkbox" id="assignedSystemGroups_2_1" class="chk" name="assignedSystemGroups" value="viewStatsBilling" > View Billing Statistics </label> </div> <div id="tCt2" dojoType="ContentPane" label="Common" style="width: 760px;"> <div class="permissionList"> <label class="chk" for="assignedSystemGroups_3_1"> <input type="checkbox" id="assignedSystemGroups_3_1" class="chk" name="assignedSystemGroups" value="baseWebAccess" > Login to Web Application </label> </div> I wanted to click on div having id="tCt2", the below code is not working: ie.div(:id,"tCt2").flash ie.div(:id,"tCt2").click Please send me a solution for this. Thanks in advance Vikash Kumar --------------------------------- Find out what India is talking about on Yahoo! Answers India. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060722/70c4583b /attachment.html ------------------------------ _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general End of Wtr-general Digest, Vol 32, Issue 34 ******************************************* _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
