Title: How to Have Watir Run Unattended?

I know this may be a little bit of extra work but here is what we do and it works fine.

 

We use CruiseControl.Net which is a service that runs on our build machine and runs at timed intervals or we can force it as well. But then from CruiseControl we have a Nant build kickoff that executes our build scripts which one of the things that is done in that is to execute our WATIR scripts.

 

Hope this helps. But as you can see it can be done and with minimal setup really. CruiseControl and Nant are both very easy to setup and get running.

 

Sergio


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gordon, John
Sent: Friday, January 20, 2006 2:30 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] How to Have Watir Run Unattended?

 

Hi all,

Does anyone know how to set up Watir to run unattended?  I’m having troubles trying to do this using a Scheduled Task.

Requirements:

1) Execute a Watir script without having to have a user login to the computer to execute it (e.g via a Service or Scheduled task).

2) Have the script notify the developers when testing fails (via email or updating a web page).

I’m trying to set up a Watir script to serve as a  “heart beat” of sorts for my web site.  The idea is that I have a watir script constantly running that tests a website and notifies our development team (via email or a status web page) when the scripts fail.  I thought I would do it by creating a Windows Scheduled task that would periodically call my Watir Script.  I’m getting an error when I execute this scheduled task, however.  The error is:

Failed to create WIN32OLE object from `InternetExplorer.Application'

    HRESULT error code:0x80070005

      Access is denied.

The script runs fine when I execute it via a command prompt.  The user the Scheduled Task is running under is an admin account, so that should be fine too.  The only thing I’m doing in the script is calling IE.new(); that’s where the error occurs. I’m wondering if the problem is due to IE being a GUI app and scheduled tasks don’t display GUI’s.  I tested this by creating a Scheduled Task to simply instantiate an instance of IE; it worked without errors.

Here’s the test I’m running:

require 'watir'

require 'test/unit'

require 'ftools'

class TC_MyCompany < Test::Unit::TestCase

include Watir

 

def test_hello_world

@ie = IE.new() #BOOM!! Error happens here.

@ie.close()

t = Time.now

time_stamp = t.strftime("Printed on %m/%d/%Y at %I:%M%p")

File.open('E:\Watir\hello.txt', "w+") { |msg_file|

       msg_file.write("successfully opened IE at #{time_stamp}")

    }

rescue

 File.open('E:\Watir\hello.txt', "w+") { |msg_file|

       msg_file.write($!)

    }

end

   

end

 

Thanks for any help you can offer!

 

John

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to