[wtr-general] Re: Measure download time of a file using watir

2010-02-11 Thread Maumita
require 'watir'
require 'win32ole'
$ie = Watir::IE.new
$ie.goto(http://localhost/dportal;)
$ie.image(:name, 'toplogo_nav_04_off').click
$ie.link(:text, 'Hitach product').click
$ie.link(:text, 'File size 220 MB').click_no_wait

prompt_message = Do you want to open or save this file?
window_title = File Download
save_dialog = WIN32OLE.new(AutoItX3.Control)
sleep 1
save_dialog_obtained =
save_dialog.WinWaitActive(window_title,prompt_message, 25)
save_dialog.ControlFocus(window_title, prompt_message, Save)
sleep 1
save_dialog.ControlClick(window_title, prompt_message, Save)
saveas_dialog_obtained = save_dialog.WinWait(Save As, Savein, 5)
sleep 1
begin_time=Time.now
path = File.dirname(D:/ruby/log/).gsub(/ , \\ )+ \\ +
login.csv
save_dialog.ControlSend(Save As, , Edit1,path)
save_dialog.ControlClick(Save As, Save in, Save)
end_time=Time.now
download_time = time_start - time_end

But my scripts exist when the file starts downloading.
Please help on this.This is urgent for my project to measure the file
download time.
Is there any other way to do this?

Thanks in advance
Maumita

On Feb 11, 2:14 am, orde ohil...@gmail.com wrote:
 I've used solution #2 onhttp://wiki.openqa.org/display/WTR/File+Downloads.

 You should be able to modify that code to get an approximate download
 time:

 time_start = Time.now
 # code
 # code
 time_end = Time.now
 download_time = time_start - time_end

 Hope it helps.

 orde

 On Feb 10, 1:30 am, Maumita maumita.majum...@gmail.com wrote:

  Hi,

  Is this possible to write a watir script that should download a file
  from website to locally and also to measure how long it takes to
  download the file.
  This is a requirement in my project. The main idea is to measure the
  download time of a file.
  Please suggest if there is any way to do this.
  Thanks in advance.

  Maumita

-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general


[wtr-general] Not able to tun .rb script through rufus scheduler

2009-09-17 Thread Maumita

Hi,

I am not able to tun a .rb script through rufus scheduler.Nothing
happens.No message,
Please find belo my scheduler script -
-
### Script to schedule a job using rufus-scheduler
require 'rubygems'
require 'rufus/sc/scheduler'

class Scheduler
  def start
scheduler = Rufus::Scheduler.start_new
scheduler.every '1m' do
  puts running test
  #`ruby dportal_monitor_Prod.rb`
  load 'dportal_monitor_Prod.rb'
   end
scheduler.join
  end
end


Scheduler.new.start
-

I tried with both -
`ruby dportal_monitor_Prod.rb`  
 load 'dportal_monitor_Prod.rb'
But not succeeded.
I have installed rufus-scheduler-2.0.1 gem installer.

Please help.

Thanks
Maumita


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] how to verify whether image is loaded or not?

2009-09-15 Thread Maumita

Hi,

using Watir,I want to check whether image on a page is loaded or not?
But my image is basically point to a URL.('showSmallProductImage.htm?
productId='+prodID)
How I will use this to check whether image is loaded or not? Below is
the html code:-


  prodID = '4028480d2332b52801233b8e92d30414';
  prodName = 'Varian CP-3800 and CP-3900 GC';

  productImage = 'showSmallProductImage.htm?
productId='+prodID;

  productCode = 'DC-00100045';

  releaseDate = '21-May-2009';
  description = 'The 3900 GC is a single channel, fixed
configuration GC incorporating the same outsta';

  cdsName = 'OpenLAB';
  instrumentName = 'Varian 3800 GC';
  vendor = 'Persistent Systems Inc.';
  cdsColor = '#CC';
  isPublished = 'true';

  var productLink = product.htm?id=+prodID;
  var product = new Object();
  product.prodID = prodID;

  product.productLink = productLink;
  product.productImage = productImage;
  product.productCode =  productCode;
  product.releaseDate =  releaseDate;
  product.cdsName =  cdsName;
  product.instrumentName  =  instrumentName;
  product.vendor =  vendor;
  product.cdsColor = cdsColor;
  product.isPublished = isPublished;

  if(description.length  72)
  description = description.substring(0,72) + '...';

  if(prodName.length  52)
  prodName = prodName.substring(0,52) + '...';

  product.productName = prodName;

  product.description =  description;

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] How to run a .rb file from .bat.

2009-09-07 Thread Maumita

Hi,

How to run a .rb file from .bat.

Please guide me.

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] To log watir output Is there any way to create the directory automatically from the script to store the results

2009-09-07 Thread Maumita

Hi,

I have created a script to log the watir output in a directory. The
problem I am facinf is that - I have to create the directory to store
the log results and have to mention the path in the script.
I want something like - Is there any way to create the directory
automatically from the script to store the results. Also, the script
will run in every hour. so all the results should get stroed in the
same directory.

Please guide. This is my script.
Please suggest where to made the changes -


#Load the library and create reference to Library object
require 'watir' #watir Controller
require 'watir/win32ole'
require 'test/unit'
require 'fileutils'
require 'logger'

# Ruby Logger
# Logger is configured to write
class Logger
  # hack format of logger
  class Formatter
#original: Format = %s, [%s#%d] %5s -- %s: %s\n
Formato = [%s] [%5s] : %s\n

def call(severity, time, progname, msg)
  #add logging to stdout
  puts output_message = msg2str(msg)
  STDOUT.flush
  #original: Format % [severity[0..0], format_datetime(time), $$,
severity, progname, msg2str(msg)]
  Formato % [format_datetime(time),severity, output_message]
end
  end
end

#Create a log file
time = Time.now.strftime(%Y-%m-%d)
logfile = File.join('d:/ruby/log', DportalMonitor_#{time}.csv)
$log = Logger.new(logfile,'daily')
$log.level = Logger::INFO
$log.datetime_format = %Y-%m-%d %H:%M:%S
$log.info(Started.)

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Is there anyway to log watir results output in a directory that has been created from the script.

2009-09-07 Thread Maumita

Hi,

Is there anyway to log watir results output in a directory that has
been created from the script. Befor logging the result, the script
will check whether the directory exists in the particular folder or
not. If it doesn't exist, then it will create the directory and log
the results.

When the same scripr run second time, if it founds the directory is
there then it will log the results in the same file.

Please help how can I do this in watir script.

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Not able to enter login credentials in Sign In section

2009-08-26 Thread Maumita

Hi,

This is a test site https://sandbox.google.com/checkout/view/buy?
o=shoppingcartshoppingcart=322449560105091pli=1tzfp=wg-14ArD

In this I am not able to enter login credentails in the Sign In
section.
--
require 'watir'
require 'test/unit'
require 'win32ole'
$ie = Watir::IE.new
test_site='https://sandbox.google.com/checkout/view/buy?
o=shoppingcartshoppingcart=322449560105091pli=1tzfp=wg-14ArD'
$ie.goto(test_site)
$ie.show_frames
$ie.text_field(:name, Email).set(a)
#$ie.text_field(:name, Passwd).set('b')
--
$ie.show_frames - it shows

--
there are 2 frames
frame  index: 1 name: signup
frame  index: 2 Access Denied, see 
http://wiki.openqa.org/display/WTR/FAQ#access-denied
d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
`assert_exists': Unable to locate element, using :name,
Email (Watir::Exc
eption::UnknownObjectException)
from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
element.rb:284:in `enabled?'
from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
element.rb:56:in `assert_enabled'
from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
input_elements.rb:323:in `set'
from D:/ruby/samples/RubySrc-1.8.6-p111/sample/
DriverCentral_Scripts/test/t.rb:11
---


Please help how can I enter login credentials in Sign In section.

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How can I add loop to check whether all the images of a page has loaded or not?

2009-08-21 Thread Maumita

Hi Bill,

Thsi is my actual script-
Script
---
#User experience script to capture response time

#Load the library and create reference to Library object
require 'watir'
require 'watir/win32ole'
require 'logger'
#include Watir

# hack ruby logger to format and output only the minimum needed for
testing scripts
# Logger is configured to write
class Logger
  # hack format of logger
  class Formatter
#original: Format = %s, [%s#%d] %5s -- %s: %s\n
#Change the name of constant to avoid redefining the super which
bugs us a bit. So let it be Formato then.
Formato = [%s] [%5s] : %s\n

#keep the original signature but alter implementation to change
formatting

def call(severity, time, progname, msg)
  #add logging to stdout
  puts output_message = msg2str(msg)
  STDOUT.flush
  #original: Format % [severity[0..0], format_datetime(time), $$,
severity, progname, msg2str(msg)]
  Formato % [format_datetime(time),severity, output_message]
end
  end
end

#Create a log file
time = Time.now.strftime(%Y-%m-%d)
logfile = File.join('D:/ruby/log', test_#{time}.csv)
$log = Logger.new(logfile,'daily')
$log.level = Logger::INFO
$log.datetime_format = %Y-%m-%d %H:%M:%S
$log.info(Started.)

#Create a new IE object
$ie = Watir::IE.new

#variables
test_site = 'http://testsite.net'


#Go to the website
begin_time = Time.now
$ie.goto(test_site)
$ie.maximize
$log.info('Hit the testsite URL,'+'Time taken to load Home page: '+
$ie.down_load_time.to_s)


#Login to testsite
$ie.text_field(:name, userName).set(user1)
$ie.text_field(:name, password).set('u1')
$ie.button(:value, Login).click
$log.info('Login to testsite,'+'Time taken to load Home page: '+
$ie.down_load_time.to_s)

#Click on products tab
$ie.image(:name, 'toplogo_nav_04_off').click

Watir::Waiter.wait_until(360, 1){
begin
puts image.width
true
rescue
false
end
}

$log.info('Click on products tab,'+'Time taken to load Products page:
'+$ie.down_load_time.to_s)
$log.info($ie.images.length)


# When my script run $ie.image(:name, 'toplogo_nav_04_off').click ,
the product page appears.The page layout sucsessfully gets loaded and
in IE status bar it says done. After that it starts rendering the
product images (these are the main images).
The product images to render takes a long time.currently the
application has only 14 product images.in future these images may get
increase up to 200.
Current behavior: As i have mentioned 360 seconds, within that time
period all 14 product images loaded successfully ,also get visible and
after 360 seconds the timeout exception is thrown on console and the
script exist.

My aim:- to capture the page load time after loading successfully all
the product images.
1 How to wait for the product images to load properly and visible on
UI
2 how I will verify whether all the product images has loaded or not.
if all the images is loaded then automatically my script will go to
the next step to execute.
3. once the page gets laoded completely with al product images then it
should record the page load time.


the below mentioned information gets displayed for each product.
I am giving the info from the source

  prodID = '4028480d22a786ea0122a833029a0085';
  prodName = 'Test product1';

  productImage = 'showSmallProductImage.htm?
productId='+prodID;

  productCode = 'DC-0012';

  releaseDate = '05-Mar-2009';
  description = 'Test description';


I am not able to get the success in this script. Please help me to
make the changes in the script. This is very urgent.
Please help.

Thanks
Maumita

On Aug 20, 10:00 pm, Bill Agee billa...@gmail.com wrote:
 According to the rdoc for the wait_until method, you can provide your own
 timeout value:

 http://wtr.rubyforge.org/rdoc/classes/Watir/Waiter.html

 So maybe something like this will work for you:

 wait_until(360, 1) { BLOCK }

 In that example 360 is the total number of seconds to wait, and 1 is the
 polling interval.

 Thanks
 Bill

 On Thu, Aug 20, 2009 at 4:19 AM, Maumita maumita.majum...@gmail.com wrote:

  I have read the topics mentioned by you. I already have used the
  wait_until method..but after 60 secs I got the time out error. And my
  webpage within the time perioed is not able to display the product
  images on UI. The product images to display on UI is taking time.Some
  time it takes 5 minutes..sometime more than that..

  Is there anyway that my script will wait untill all product images are
  loaded and displayed properly?
  Or is there anyway to verify that all the images on the page are
  visible or not?

  In this scenario, how I will capture the page load time?

  On Aug 20, 3:03 pm, Željko Filipin zeljko.fili...@wa-research.ch
  wrote:
   Have you read this?

  http://wiki.openqa.org/display/WTR/How+to+wait+with+Watir

   Željko
   --http://watirpodcast.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups

[wtr-general] How can I add loop to check whether all the images of a page has loaded or not?

2009-08-20 Thread Maumita

Hi,

I am testing a webpage where my aim is to wait for the page to load
all the images and once the page loaded all images i will record the
page load time.

using wait_until and sleep, still images are not loading within the
time period and i don't want to hard code the time limit to load.

Is there anyway to introduce loop to check whether the page has loaded
all the images or not? Also all images should be visible on UI.

My script:-
--
 require 'watir'
 require 'watir/contrib/visible.rb'
 include Watir

 $ie = Watir::IE.new

 test_site = 'http://test.net'
 $ie.goto(test_site)
 $ie.maximize
 $log.info( 'Time taken to load Home page' )
 $log.info($ie.down_load_time.to_s)


 #Perform Login Action
 $log.info(Login to testsite)
 $ie.text_field(:name, userName).set(user)
 $ie.text_field(:name, password).set('u1')

 $ie.button(:value, Login).click
 $log.info( 'Time taken to load Home page' )
 $log.info($ie.down_load_time.to_s)

 #Click on Products tab

 $log.info(Click on products tab)
 $ie.image(:name, 'toplogo_nav_04_off').click
 $ie.images.each{|image|Watir::Waiter.wait_until(10){image.exist?}} # in this 
 step I need to wait until all the images is loaded properly and visible.How 
 can I add loop here to check all the images are loaded or not?

 $log.info( 'Time taken to load Products page' )
 $log.info($ie.down_load_time.to_s)
 $log.info($ie.images.length)


 

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How can I add loop to check whether all the images of a page has loaded or not?

2009-08-20 Thread Maumita

I have read the topics mentioned by you. I already have used the
wait_until method..but after 60 secs I got the time out error. And my
webpage within the time perioed is not able to display the product
images on UI. The product images to display on UI is taking time.Some
time it takes 5 minutes..sometime more than that..

Is there anyway that my script will wait untill all product images are
loaded and displayed properly?
Or is there anyway to verify that all the images on the page are
visible or not?

In this scenario, how I will capture the page load time?

On Aug 20, 3:03 pm, Željko Filipin zeljko.fili...@wa-research.ch
wrote:
 Have you read this?

 http://wiki.openqa.org/display/WTR/How+to+wait+with+Watir

 Željko
 --http://watirpodcast.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] How to delete cookies in Firefox through firewatir script?

2009-08-17 Thread Maumita

Hi,

How to delete cookies in Firefox through firewatir script?

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Is there anyway to wait until all images of a page is not loaded properly.

2009-08-17 Thread Maumita

Hi,

I have written a script to capture the page download time.

The page has different shopping item images along with their price
details.
The script capture the time and stops when the page layout (page
framework) is loaded completely .It doesn't include the images of all
the shopping items.

I observed that, once the page framework is loaded completely then
Done message appears on the status bar, after that it starts rendering
the shopping item images one by one.Once all the shopping images is
loaded then again it says Done on status bar (checked in browser IE)

Is there any way , my scripts will not stop after the 1st Done. It
will wait until all the images is not loaded.
I checked the same behavior with website like -Amazon.

I can't use sleep()..because it will not work always if network
connection is very slow.

This is urgent.Please help.

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Not able to run automatically a script automatically using rufus-scheduler

2009-08-13 Thread Maumita

I'm trying to use rufus-scheduler to run automatically a script in
every 1 hr. But not able to do that..
This is the script -

require 'rubygems'
require 'rufus/scheduler'

class Scheduler
  def start
scheduler = Rufus::Scheduler.start_new
scheduler.every '1h' do
  puts running test
  `ruby test1.rb`
end
scheduler.join
  end
end

Running test1.rb at the command line pops up an instance of IE,log in
to the application,search a keyword and log out from application.

How to run this script?
Is there anything I am missing?
Please help.

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: user experience response time script.

2009-08-12 Thread Maumita

Thanks a lot for the quick help..
It works for me..

Also, I will definitely use Jmeter for performace

Thanks
Maumita

On Aug 11, 7:01 pm, Felipe Knorr Kuhn fkn...@gmail.com wrote:
 Hello Maumita,

 As Tony said, you should probably stick to JMeter.

 But, if you really want to do that quickly with Ruby, you could try the
 following:

 t1 = Time.now

  Navigate through the site 

 t2 = Time.now

 puts time taken:  + t2-t1.to_s +  seconds

 FK

 On Tue, Aug 11, 2009 at 9:25 AM, Tony ynot...@gmail.com wrote:

  Hi Maumita,

  The scenario you have described here is performance testing the
  shopping website.
  Would suggest you use jmeter or another performance test tool to do
  this.

  Watir is best used for functional testing.

  Thanks,
  Tony
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Is there any way to run a watir script automatically in every hour.

2009-08-12 Thread Maumita

Hi,

We are developing a shopping site.
I have written a script, it basically hit a WEB URL and capture the
page load time -
1. It hits the home page
2. It hits the products page (This page has images of 9 items)

For the above cases the script return me the time taken to load the
page.

Problems:-
1. One thing I observed that for case2, some time the script return
the page load time before finishing the image loading. How can I solve
this problem?
2. Is there any way to run a watir script automatically in every hour.

Its urgent for my project related task.

Thanks in  advance.

Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] undefined method `length' for nil:NilClass

2009-08-11 Thread Maumita

Hi all

 I have written a script, in which from an excel file a value will get
enter in the text field ie.text_field(:name, productName).set
$worksheet.Range(a#{i}).value

My script:

require 'watir'
include Watir

$excel_path = D:/Data/dportalTestScripts/Product.xlsx
$sheet_id   = 1
$excel = WIN32OLE.new(excel.application)
$excel['Visible'] = true;
$workbook = $excel.Workbooks.Open $excel_path
$worksheet = $workbook.WorkSheets($sheet_id)
$worksheet.Select

 ie = Watir::IE.new
 ie.goto(http://test.com;)
 ie.text_field(:name, userName).set(a)
 ie.text_field(:name, password).set('d')
 ie.button(:value, Login).click
 ie.image(:name, 'toplogo_nav_08_off').click
 ie.link(:text, Manage Products).click
 ie.link(:text, Create Product).click

ie.text_field(:name, productName).set $worksheet.Range(a#
{i}).value

I get the error when my script gets to this point (ie.text_field
(:name, productName).set $worksheet.Range(a#{i}).value)

D:\Data\dportalTestScriptsCreate Multiple Product.rb
d:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:4005:in
`doKeyPress': undefined method `length' for nil:NilClass
(NoMethodError)
from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./
watir.rb:3986:in `set'
from D:/Data/dportalTestScripts/Create Multiple Product.rb:50

Does anyone know if my problem is the length of the field name or ?
Is there any way around the problem? The length of the field name is
100

Thanks in advance for any help you can provide!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: undefined method `length' for nil:NilClass

2009-08-11 Thread Maumita

Please find the updated script -

require 'watir'
include Watir

$excel_path = D:/Data/dportalTestScripts/Product.xlsx
$sheet_id   = 1
$excel = WIN32OLE.new(excel.application)
$excel['Visible'] = true;
$workbook = $excel.Workbooks.Open $excel_path
$worksheet = $workbook.WorkSheets($sheet_id)
$worksheet.Select

 ie = Watir::IE.new
 ie.goto(http://test.com;)
 ie.text_field(:name, userName).set(a)
 ie.text_field(:name, password).set('d')
 ie.button(:value, Login).click
 ie.image(:name, 'toplogo_nav_08_off').click
 ie.link(:text, Manage Products).click
 ie.link(:text, Create Product).click

i = 1
until i  3
ie.text_field(:name, productName).set $worksheet.Range(a#
{i}).value
ie.button(:name, submit_btn).click

if i == 3
break
  end
  i+=1
end


Thanks
Maumita


On Aug 11, 3:41 pm, John Kolokotronis johnj...@gmail.com wrote:
 The local variable i in your last line isn't defined anywhere in your
 script...

 So: ie.text_field(:name, productName).set $worksheet.Range(a#
 {i}).value)

 i isn't defined so no value is retrieved. If you are trying to
 retrieve a number of cells, you can do it with a for loop:

 for i in 1..5 # to get the first five cells...
   ie.text_field(:name, productName).set($worksheet.Range(a#
 {i}).value) # Note the missing bracked in your original...
 end

 This is assuming the rest of your code is correct, which I haven't
 tested. You could try outputting the Excel values to the command line
 first to make sure you are getting the expected results - length is
 not your problem, the error simply is there because you are passing a
 nil value...

 Regards,

 John
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] user experience response time script.

2009-08-11 Thread Maumita

Hi,

we are developing a shopping website.
I want to write a user experience response time script.
The script should contain the following steps -
Users - 3

1. 3 users will hit a URL at the same time
2. 3 users will click on a product tab and the product page will
appear. The product page will have images of total 9 items along with
their product name and price  on one page
3. 3 users will click on any of the product name
4. The corresponding product detail page will appears. The product
detail page will have description about the product and more info.

In all the above cases, we want to capture the response time of the
page to load.
Is this possible in watir. Its urgent

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Using watir can we check performance of an application

2009-07-08 Thread Maumita

Hi,

I am new in watir. I want to know can I do load testing using watir.
My scenario is : I want to hit my web application using 100 users at
the same time.
We are developing a shopping site where our aim is to check the
performance of the site, when 100 users hit the url at the same time
and do some search for products to buy.

Please help on this.
This is an urgent requirement for my project.

Thanks
Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How to display row,clolumn values of a table

2009-06-29 Thread Maumita

hi,

I have posted the html part.please help on this

div class =contentDiv
h3Shopping Cart/h3
brbr

table border=2
   tdbQuantity/b/td
   tdbName/b/td

   tdbUnit Price/b/td
   tdbTotal Price/b/td


   tr
   td
   input id = '1_PRODUCT' type=text
value='3' maxlength=3 size=3/
   /td
   td
   DV007-PRODUCT
   /td

   td
   77.00
   /td
   td
   span id ='1_PRODUCT_totalPrice'/span
   script
   var q ='3';
   var p = '77.00';
   var id = '1_PRODUCT_totalPrice';
   document.getElementById
(id).innerHTML=Number(q)*Number(p);
   /script
   /td
   /tr

   tr

   td
   input id = '1_SMA' type=text
value='3' maxlength=3 size=3/
   /td
   td
   DV007-SMA
   /td
   td
   7.00
   /td
   td

   span id ='1_SMA_totalPrice'/span
   script
   var q ='3';
   var p = '7.00';
   var id = '1_SMA_totalPrice';
   document.getElementById
(id).innerHTML=Number(q)*Number(p);
   /script
   /td
   /tr

   tr
   td
   input id = '1_INSTALLATION'
type=text value='3' maxlength=3 size=3/
   /td

   td
   DV007-INSTALLATION
   /td
   td
   7.00
   /td
   td
   span id ='1_INSTALLATION_totalPrice'/
span
   script
   var q ='3';
   var p = '7.00';
   var id =
'1_INSTALLATION_totalPrice';
   document.getElementById
(id).innerHTML=Number(q)*Number(p);
   /script

   /td
   /tr


   /table

Thanks
Maumita

On Jun 29, 2:23 pm, Ye Jian j...@cn.ufinity.com wrote:
 Try with following code.

 t = $ie.table(:class,table_list)
 print table columns: ,t.column_count.to_s
 print \ntable rows: ,t.row_count.to_s
 print \nthe first column of first row:,t.column_values(1)[1]
 print \nthe second column of first row:,t.column_values(0)[1]

 Any question,pls let me know.

 -Camael

 发件人: Maumita
 发送时间: 2009-06-29  17:13:03
 收件人: Watir General
 抄送:
 主题: [wtr-general] How to display row,clolumn values of a table

 Hi,
 I am facing one problem.
 I have a table.the table don't have name,id,index.
 How to display the row, column values of that table without name,id.
 Thanks
 Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] How to check if a button is enabled or disabled

2009-06-25 Thread Maumita

Hi,

Is this pissible in watir to check if a button is enabled or disabled?
If yes..please guide me how?

Thanks
Maumita

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How to click on Ok of a pop-up message window

2009-06-24 Thread Maumita

Hi,

I did the following changes but then also not bale to click on the OK
button.
Please suggest if I am wrong.
IE version I was using is 6.So I did the following steps-
1 changed the title on the JS Alert box in WinClicker.rb file
IE6 = Microsoft Internet Explorer

2 Made changes to the script

require 'watir'
include Watir

def check_for_popups(title=Microsoft Internet Explorer, button=OK)
popup=Thread.new {
autoit=WIN32OLE.new('AutoItX3.Control')
ret=autoit.WinWait(title,,60)
if (ret==1)
puts There is popup.
autoit.WinActivate(title)
button.downcase!
if button.eql?(ok) || button.eql?(yes) || button.eql?
(continue)
autoit.Send({Enter})
else
autoit.Send({tab})
autoit.Send({Enter})
end
elsif (ret==0)
puts No popup
end
}
at_exit { Thread.kill(popup) }
end

$ie = Watir::IE.new
$ie.goto(http://localhost/new;)
$ie.text_field(:name, userName).set(user1)
$ie.text_field(:name, password).set(password)
$ie.button(:value, Login).click
$ie.link(:text, Manage Products).click
$ie.link(:text, Create Product).click
$ie.text_field(:name, productName).set('Test')
$ie.text_field(:name, description).set('Test1')
$ie.button(:name, submit_btn).click
check_for_popups(Microsoft Internet Explorer, OK)


Thanks
Maumita

On Jun 23, 9:14 pm, orde ohil...@gmail.com wrote:
 Check these pages out:

 http://wiki.openqa.org/display/WTR/Pop+Upshttp://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups

 orde

 On Jun 23, 5:24 am, Maumita maumita.majum...@gmail.com wrote:

  Hi,

  I am facing a problem.
  I had written a script that submit a form.Befor submitting the form,if
  any field entry is missing in the form then a java pop-up window
  appears.
  Windows title -Microsoft Internet Explorer
  Prompt Message - 'You have not selected an image.Do you want to
  continue'.
  This window has Ok and cancel button.
  when user clicks on Ok the form automatically gets submitted.

  I don't know how to click on the OK button when the pop up window
  appears.

  Please suggest me.

  Below is my script -

  require 'watir'
  require 'win32ole'
  include Watir

      $excel_path = D:/Data/dportalTestScripts/Product.xlsx
      $sheet_id   = 1
      $excel = WIN32OLE.new(excel.application)
      $excel['Visible'] = true;
      $workbook = $excel.Workbooks.Open $excel_path
      $worksheet = $workbook.WorkSheets($sheet_id)
      $worksheet.Select

  ie = Watir::IE.new

  #Navigate to dportal
  ie.goto(http://test/new;)
  ie.text_field(:name, userName).set()
  ie.text_field(:name, password).set()
  ie.button(:value, Login).click
  ie.link(:text, Manage Products).click
  ie.link(:text, Create Product).click

        ie.text_field(:name, productName).set $worksheet.Range(a#
  {i}).value
        ie.text_field(:name, description).set $worksheet.Range(b#
  {i}).value
        ie.text_field(:name, copyright).set $worksheet.Range(c#
  {i}).value
        ie.text_field(:name, 'releaseDate').value= $worksheet.Range(d#
  {i}).value
        #ie.fileField(:name, imageFile).set $worksheet.Range(f#
  {i}).value
        ie.select_list(:name, vendor).select $worksheet.Range(e#
  {i}).value
        ie.select_list(:name, instrument).select $worksheet.Range(f#
  {i}).value
        ie.select_list(:name, cds).select $worksheet.Range(g#
  {i}).value
        ie.checkbox(:name, isPublished).set
        ie.text_field(:name, productCosts[0].cost).value=
  $worksheet.Range(h#{i}).value
        ie.button(:name, submit_btn).click_no_wait

   Thanks
  Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How to click on Ok of a pop-up message window

2009-06-24 Thread Maumita

Thanks for the help.It solves my problem

On Jun 24, 2:56 pm, Ye Jian j...@cn.ufinity.com wrote:
 change $ie.button(:name, submit_btn).click to $ie.button(:name, 
 submit_btn).click_no_wait and try again.

 -Camael

 发件人: Maumita
 发送时间: 2009-06-24  17:50:06
 收件人: Watir General
 抄送:
 主题: [wtr-general] Re: How to click on Ok of a pop-up message window

 Hi,
 I did the following changes but then also not bale to click on the OK
 button.
 Please suggest if I am wrong.
 IE version I was using is 6.So I did the following steps-
 1 changed the title on the JS Alert box in WinClicker.rb file
     IE6 = Microsoft Internet Explorer
 2 Made changes to the script
 require 'watir'
 include Watir
 def check_for_popups(title=Microsoft Internet Explorer, button=OK)
     popup=Thread.new {
         autoit=WIN32OLE.new('AutoItX3.Control')
         ret=autoit.WinWait(title,,60)
         if (ret==1)
             puts There is popup.
             autoit.WinActivate(title)
             button.downcase!
             if button.eql?(ok) || button.eql?(yes) || button.eql?
 (continue)
                 autoit.Send({Enter})
             else
                 autoit.Send({tab})
                 autoit.Send({Enter})
             end
         elsif (ret==0)
             puts No popup
         end
     }
     at_exit { Thread.kill(popup) }
 end
 $ie = Watir::IE.new
 $ie.goto(http://localhost/new;)
 $ie.text_field(:name, userName).set(user1)
 $ie.text_field(:name, password).set(password)
 $ie.button(:value, Login).click
 $ie.link(:text, Manage Products).click
 $ie.link(:text, Create Product).click
 $ie.text_field(:name, productName).set('Test')
 $ie.text_field(:name, description).set('Test1')
 $ie.button(:name, submit_btn).click
 check_for_popups(Microsoft Internet Explorer, OK)
 Thanks
 Maumita
 On Jun 23, 9:14爌m, orde ohil...@gmail.com wrote:

  Check these pages out:

 http://wiki.openqa.org/display/WTR/Pop+Upshttp://wiki.openqa.org/disp...

  orde

  On Jun 23, 5:24燼m, Maumita maumita.majum...@gmail.com wrote:

   Hi,

   I am facing a problem.
   I had written a script that submit a form.Befor submitting the form,if
   any field entry is missing in the form then a java pop-up window
   appears.
   Windows title -Microsoft Internet Explorer
   Prompt Message - 'You have not selected an image.Do you want to
   continue'.
   This window has Ok and cancel button.
   when user clicks on Ok the form automatically gets submitted.

   I don't know how to click on the OK button when the pop up window
   appears.

   Please suggest me.

   Below is my script -

   require 'watir'
   require 'win32ole'
   include Watir

   ??$excel_path = D:/Data/dportalTestScripts/Product.xlsx
   ??$sheet_id ?= 1
   ??$excel = WIN32OLE.new(excel.application)
   ??$excel['Visible'] = true;
   ??$workbook = $excel.Workbooks.Open $excel_path
   ??$worksheet = $workbook.WorkSheets($sheet_id)
   ??$worksheet.Select

   ie = Watir::IE.new

   #Navigate to dportal
   ie.goto(http://test/new;)
   ie.text_field(:name, userName).set()
   ie.text_field(:name, password).set()
   ie.button(:value, Login).click
   ie.link(:text, Manage Products).click
   ie.link(:text, Create Product).click

   ???ie.text_field(:name, productName).set $worksheet.Range(a#
   {i}).value
   ???ie.text_field(:name, description).set $worksheet.Range(b#
   {i}).value
   ???ie.text_field(:name, copyright).set $worksheet.Range(c#
   {i}).value
   ???ie.text_field(:name, 'releaseDate').value= $worksheet.Range(d#
   {i}).value
   ???#ie.fileField(:name, imageFile).set $worksheet.Range(f#
   {i}).value
   ???ie.select_list(:name, vendor).select $worksheet.Range(e#
   {i}).value
   ???ie.select_list(:name, instrument).select $worksheet.Range(f#
   {i}).value
   ???ie.select_list(:name, cds).select $worksheet.Range(g#
   {i}).value
   ???ie.checkbox(:name, isPublished).set
   ???ie.text_field(:name, productCosts[0].cost).value=
   $worksheet.Range(h#{i}).value
   ???ie.button(:name, submit_btn).click_no_wait

   燭hanks
   Maumita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] How I can verify whether all the images of a web page have been loaded or not?

2009-05-28 Thread Maumita

Hi,

Iam  new in  Watir. We are designing a web site through which user can
buy items like we have in AMAZON.

I have written a script to capture the landing page load response
timing (see below)

require 'watir' # watir controller
include Watir
require 'test/unit'
#require 'watir/WindowHelper'


class TC_TimeResponse  Test::Unit::TestCase

 def test_TimeResponse
ie = Watir::IE.new
ie.goto(URL)
ie.text_field(:name, 'userName').set('')
ie.text_field(:name, 'password').set('')
ie.button(:value, 'Login').click
ie.maximize
ie.image(:src, /logo/).click
p 'ie.down_load_time_Home Page for 85:
'+ie.down_load_time.to_s
   end
end

This script works fine and it displayed the page load timing in
console.

Basically, the landing page contains information about 9 items along
with their image of fixed size 79 * 79.
I observed that sometime the script runs and displayed the result of
page load timing but few of the images is still not loaded.

My question:-
1. How I can verify whether all the images have been loaded or not?
2. Is there any other way to find out the actual page load timing
including the images of the items.

Please this is an urgent requirement for my project.
Waiting for solution.

Thanks
Maumita

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---