Unable to run(automate) different file via Ruby

P

Pranjal Jain

Hi
I am having a LoadRunner File which I want to run via Ruby Script.
I am trying to execute it proper functioning, but can't.

I am putting the script here; please suggest if i am committing any
mistake.

Script is as follows :


# WinClicker Library of Watir module required
require 'watir/winClicker'

# path of the script is specified
Dir.chdir("d:/Load Runner/gmail") {system("gmail.usr")}
#sleep 25
#wsh.SendKeys('{F5}')


Thankx in advance :)
 
G

Gordon Thiesfeld

Hi
I am having a LoadRunner File which I want to run via Ruby Script.
I am trying to execute it proper functioning, but can't.

I am putting the script here; please suggest if i am committing any
mistake.

Script is as follows :


# WinClicker Library of Watir module required
require 'watir/winClicker'

# path of the script is specified
Dir.chdir("d:/Load Runner/gmail") {system("gmail.usr")}

Kernel.system doesn't know how to handle these files. You'd get the
same thing if you tried to run a ruby file:

# test .rb
puts 'hello world'

# irb sessionhello world
=> truehello world
=> true

So, either write the command so that it calls the executable that runs
your .usr file, or use 'call'.

Hope that helps,

Gordon
 
P

Pranjal Jain

HI Gordon
Thankx it worked.
But now I am facing a new problem, when I want to run tht script , I
cant do it.
the script is as follows :

# This script can drive any scripts return anywhere on system

# WinClicker Library of Watir module required
require 'watir/winClicker'
require 'win32ole'

wsh = WIN32OLE.new('Wscript.Shell')
# path of the script is specified
Dir.chdir("d:/Load Runner/gmail") {system("call gmail.usr")}
puts "Start"
sleep 3
wsh.SendKeys('%u')
wsh.SendKeys('R')

# Wait for 2 seconds
sleep 2
puts "end"

Thankx in advance :)
 
G

Gordon Thiesfeld

HI Gordon
Thankx it worked.
But now I am facing a new problem, when I want to run tht script , I
cant do it.

I'm not sure I understand your problem, but if you're wanting to just
start gmail.usr, and continue with your script without waiting for it
to finish, you can change call to start. This will start gmail.usr in
a different cmd window.

Gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top