Re: [Wtr-general] The Plan for Watir

2007-05-09 Thread Chris McMahon
On 5/10/07, Walter Kruse <[EMAIL PROTECTED]> wrote:
> I am very keen to have this done, but leeching isn't nice and I can't
> write C. If there is forward movement on win32guitest, I volunteer to do
> a document for it, either a user guide, or something in the style of
> this: http://www.piotrkaluski.com/files/winguitest/docs/winguitest.html

As the Official Cheerleader for GuiTest in Ruby:  go for it.

I think that there is useful stuff there, but Wayne Vucenic and I both
lost interest not long after Wayne wrote the code, and I'm not exactly
sure how far he got.   Someday I'll get back to it, but not anytime
soon.  I don't remember that there is a lot of C involved.  I think
it's mostly negotiating the Win32 interfaces.

Let me know if you need any privileged access.  I'm pretty sure I'm
still set up to make that happen.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] The Plan for Watir

2007-05-09 Thread Walter Kruse
I am very keen to have this done, but leeching isn't nice and I can't
write C. If there is forward movement on win32guitest, I volunteer to do
a document for it, either a user guide, or something in the style of
this: http://www.piotrkaluski.com/files/winguitest/docs/winguitest.html
I have made extensive use of Perl's equivalent at a previous client.

Walter

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: 10 May 2007 12:39 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] The Plan for Watir

Chris McMahon wrote:
> There might still be enough there to work with.
> This is a port of Perl Win32::GuiTest, btw
That is good to hear. Since a release was never made, i had assumed that

it was an abandoned project. I just took another look and found i was 
able to run all the tests successfully.

 From what you say, i would say that the next step would be to package 
this as a gem and create some rdoc, even if it was only something simple

that pointed you to the corresponding perl docs.

I was also confused by the guitest020218 directory. Should i just ignore

this? There are duplicates of several files (cguitest.so, guitest.rb). 
Which is the correct one to use?

Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
**
Everything in this e-mail and attachments relating to the official business of 
MultiChoice Africa is proprietary to 
the company. Any view or opinion expressed in this message may be the view of 
the individual and should not automatically 
be ascribed to the company.  If you are not the intended recipient, you may not 
peruse, use, disseminate, distribute or 
copy this message. If you have received this message in error, please notify 
the sender immediately by email, facsimile 
or telephone and destroy the original message.
**
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Having trouble capturing text in java alert

2007-05-09 Thread SHALINI GUPTA

once again..use this function start_jsalert_clicker...before the object who
is responsible for java alert popup..

On 5/10/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi
u can use this code..
def start_jsalert_clicker
Thread.new{ system("ruby \"c:\\PSC\\jscriptExtraAlert.rb\"") }
#please specify ur path of jscriptExtraAlert
  end
  u have to change ur windowhelper.rb file as...
def push_alert_button
@autoit.WinWait "Window Internet Explorer", ""
text = @ autoit.WinGetText "Window Internet Explorer"
file = File.open("c:\\test.txt", "w")
file.puts text
puts text.to_s
file.close
@autoit.Send "{ENTER}"
end

after then u can read content of these file..ok...
Regards
Shalini Gupta



On 5/9/07, gary <[EMAIL PROTECTED]> wrote:
>
> Thanks for the prompt reply.
>
> I added the code but it appears to return a value of 'Google', any
> ideas?
>
> require 'watir'   # the controller
> include Watir
> require 'watir/WindowHelper'
> require 'test/unit'
> require 'test/unit/ui/console/testrunner'
> require 'dl/win32'
> require 'watir/winClicker'
>
> class TC_recorded < Test::Unit::TestCase
>
>   def startClicker( button , waitTime = 3)
>   w = WinClicker.new
>   longName = @IE0.dir.gsub("/" , "\\" )
>   shortName = w.getShortFileName(longName)
>   c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button }
> #{waitTime} "
>   puts "Starting #{c}"
>   w.winsystem(c)
>   w=nil
>   end
>
>   def test_1
>   @IE0 = IE.new
>   @IE0.set_fast_speed
>   @IE0.goto("www.hmv.co.uk")
>   @IE0.link(:text, "Sign In").click
>
>   w = WinClicker.new
>   text = w.get_static_text('Windows Internet Explorer') # returns an
> array for each static control
>   text.each {|t| puts t}
>
>   startClicker("OK" , 3)
>   @IE0.image(:alt, "continue").click
>
>
>   @IE0.close
>   end
> end
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>


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

Re: [Wtr-general] Having trouble capturing text in java alert

2007-05-09 Thread SHALINI GUPTA

hi
u can use this code..
def start_jsalert_clicker
   Thread.new{ system("ruby \"c:\\PSC\\jscriptExtraAlert.rb\"") }
#please specify ur path of jscriptExtraAlert
 end
 u have to change ur windowhelper.rb file as...
def push_alert_button
   @autoit.WinWait "Window Internet Explorer", ""
   text = @autoit.WinGetText "Window Internet Explorer"
   file = File.open("c:\\test.txt", "w")
   file.puts text
   puts text.to_s
   file.close
   @autoit.Send "{ENTER}"
end

after then u can read content of these file..ok...
Regards
Shalini Gupta



On 5/9/07, gary <[EMAIL PROTECTED]> wrote:


Thanks for the prompt reply.

I added the code but it appears to return a value of 'Google', any ideas?

require 'watir'   # the controller
include Watir
require 'watir/WindowHelper'
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'dl/win32'
require 'watir/winClicker'

class TC_recorded < Test::Unit::TestCase

  def startClicker( button , waitTime = 3)
  w = WinClicker.new
  longName = @IE0.dir.gsub("/" , "\\" )
  shortName = w.getShortFileName(longName)
  c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button }
#{waitTime} "
  puts "Starting #{c}"
  w.winsystem(c)
  w=nil
  end

  def test_1
  @IE0 = IE.new
  @IE0.set_fast_speed
  @IE0.goto("www.hmv.co.uk")
  @IE0.link(:text, "Sign In").click

  w = WinClicker.new
  text = w.get_static_text('Windows Internet Explorer') # returns an array
for each static control
  text.each {|t| puts t}

  startClicker("OK" , 3)
  @IE0.image(:alt, "continue").click


  @IE0.close
  end
end
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

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

Re: [Wtr-general] How to handle pop dialouge boxes by clicking on OK button

2007-05-09 Thread SHALINI GUPTA

in second solution have u changed the path:-
Thread.new{ system("ruby \"c:\\PSC\\jscriptExtraAlert.rb\"") }

i mean to say jscriptExtraAlert...path..
search this file and specy path there...



On 5/10/07, vamsi <[EMAIL PROTECTED]> wrote:


Hi Shalini,

Thank you very much for your response.

How ever i couldn't able to resolve my issue with these solutions.

1 soultion : giving error message as 'NoMethodError: undefined method
`dir' for nil:NilClass'
 and not moving to the next line '$ie.button(:name,"button
responsible for popup")'
2. Solution: Problem is same.. Not handling the popup
updated  windowhelper.rb file too.

Thanks in advance.


Regards
Vamsi
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

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

Re: [Wtr-general] Using custom attributes

2007-05-09 Thread Angrez Singh

Hi,

With Watir > 1.4.1 you can use xpath to access such elements.

tr = ie.element_by_xpath("//[EMAIL PROTECTED]'12345']")

- Angrez

On 5/10/07, Andrew Kuzmin <[EMAIL PROTECTED]> wrote:


 Hi All,



Is there any way to access an element by a custom attributes value ?



In my situation, for our web development we're using 3-rd party grid
control, which generates a table with lot of custom attributes for its
elements.  For example,  the code would look like this:  …

Since the rowKey is unique it could be used to uniquly identify the row.



IE's devTool displays these custom attributes correctly, however they are
not accessible from Watir.



Any recommendations ? Could Watir be extended to do this ?



Thanks,

Andrew

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

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

Re: [Wtr-general] How to handle pop dialouge boxes by clicking on OK button

2007-05-09 Thread vamsi
Hi Shalini,

Thank you very much for your response.

How ever i couldn't able to resolve my issue with these solutions.

1 soultion : giving error message as 'NoMethodError: undefined method `dir' for 
nil:NilClass' 
 and not moving to the next line '$ie.button(:name,"button 
responsible for popup")'
2. Solution: Problem is same.. Not handling the popup
 updated  windowhelper.rb file too.

Thanks in advance.


Regards
Vamsi
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Watir Data types exported from excel

2007-05-09 Thread Paul Rogers
your code doesnt show where you create spreadsheetdate but if you use either 
the text or attribute ( i cant remember which, and dont have excel here ) 

myval = worksheet.range('a2')['value']  # or ['text']


one of these will do the right thing

Paul
  - Original Message - 
  From: Tunde Jinadu 
  To: Wtr-general@rubyforge.org 
  Sent: Wednesday, May 09, 2007 3:01 PM
  Subject: [Wtr-general] Watir Data types exported from excel


  I'm running a script to read data from a spreadsheet using the following 
script

  # open the spreadsheet and get the values
  excel = WIN32OLE::new('excel.Application') # define the type of 
application to connect too 
  workbook = excel.Workbooks.Open('d:\Smoke_Test2.xls') # spreadsheet 
location
  worksheet = workbook.Worksheets(1) #get hold of the second worksheet
  worksheet.Select  #bring it to the front -need sometimes to run macros, 
not for working with a worksheet from ruby 
  range=worksheet.range("a1", "bw50") # range of spreadsheet
  #~ excel['Visible'] = false #make visible, set to false to make invisible 
again. Don't need it to be visible for script to work 


  the value I am picking out of the spreadsheet is a number 

  

  using the following

  ie.text_field(:id,/AccountNumber/).set(spreadsheetdata[:'accountnumber'].to_i)

  when the script enters data into the field it attempts to enter data as 
follows .0 (decimal place materialises.)

  I think ruby changes the format of the number 111 extracted from the 
spreadsheet from an integer as specified using .to_i to another format (hence 
the decimal place being displayed in the form field) How can I ensure the 
format of the data extracted from excel stays as an integer or text, allowing a 
leading zero as '0111' or '' 








  -- 
  The second half of a man's life is made up of nothing but the habits he has 
acquired during the first half.
- Fyodor Dostoevsky 


--


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

Re: [Wtr-general] Using custom attributes

2007-05-09 Thread Paul Rogers
you can do it like this ( search the list if this doesnt work 'cos Im doing it 
by memory and I answered the same question a couple months back )

try this
link(:index,1).ole_object.invoke('custom')

Paul


  - Original Message - 
  From: Andrew Kuzmin 
  To: wtr-general@rubyforge.org 
  Sent: Wednesday, May 09, 2007 4:55 PM
  Subject: [Wtr-general] Using custom attributes


  Hi All,

   

  Is there any way to access an element by a custom attributes value ?

   

  In my situation, for our web development we're using 3-rd party grid control, 
which generates a table with lot of custom attributes for its elements.  For 
example,  the code would look like this:  .

  Since the rowKey is unique it could be used to uniquly identify the row.

   

  IE's devTool displays these custom attributes correctly, however they are not 
accessible from Watir.

   

  Any recommendations ? Could Watir be extended to do this ?

   

  Thanks,

  Andrew



--


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

Re: [Wtr-general] Watir Data types exported from excel

2007-05-09 Thread Charley Baker

You're converting it to an integer with to_i. Pull the string and do what
you want with it, integers don't have a leading 0, strings do. Unless anyone
has a better idea, you'd be better off working with the basic string
yourself and converting it.

-c

On 5/9/07, Tunde Jinadu <[EMAIL PROTECTED]> wrote:


I'm running a script to read data from a spreadsheet using the following
script

# open the spreadsheet and get the values
excel = WIN32OLE::new('excel.Application') # define the type of
application to connect too
workbook = excel.Workbooks.Open('d:\Smoke_Test2.xls') # spreadsheet
location
worksheet = workbook.Worksheets(1) #get hold of the second worksheet
worksheet.Select  #bring it to the front -need sometimes to run
macros, not for working with a worksheet from ruby
range=worksheet.range("a1", "bw50") # range of spreadsheet
#~ excel['Visible'] = false #make visible, set to false to make
invisible again. Don't need it to be visible for script to work


the value I am picking out of the spreadsheet is a number



using the following

ie.text_field
(:id,/AccountNumber/).set(spreadsheetdata[:'accountnumber'].to_i)

when the script enters data into the field it attempts to enter data as
follows .0 (decimal place materialises.)

I think ruby changes the format of the number 111 extracted from the
spreadsheet from an integer as specified using .to_i to another format
(hence the decimal place being displayed in the form field) How can I ensure
the format of the data extracted from excel stays as an integer or text,
allowing a leading zero as '0111' or ''








--
The second half of a man's life is made up of nothing but the habits he
has acquired during the first half.
  - Fyodor Dostoevsky
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

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

[Wtr-general] Using custom attributes

2007-05-09 Thread Andrew Kuzmin
Hi All,

 

Is there any way to access an element by a custom attributes value ?

 

In my situation, for our web development we're using 3-rd party grid
control, which generates a table with lot of custom attributes for its
elements.  For example,  the code would look like this:  ...

Since the rowKey is unique it could be used to uniquly identify the row.

 

IE's devTool displays these custom attributes correctly, however they
are not accessible from Watir.

 

Any recommendations ? Could Watir be extended to do this ?

 

Thanks,

Andrew

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

Re: [Wtr-general] Using an ie.table.each do |row| loop when thepagein the ie window refreshes itself

2007-05-09 Thread Ethan Jewett
Ticket entered: http://jira.openqa.org/browse/WTR-149

Ian's point about 0-indexing vs. 1-indexing is noted in the ticket.
Perhaps this should only be a candidate for inclusion in Watir 1.6?

Ethan

On 5/8/07, Ian Webb <[EMAIL PROTECTED]> wrote:
> This worked great! I only had to make a couple of minor corrections.
>
> First off, each_with_index starts counting at 0, while Watir starts
> counting as 1. So I had to do rows_to_click << (i+1). And when iterating
> back through the table to actually click the links, I had to add ie.wait
> to that loop to keep it from trying to click the link as soon as the
> child window closed, before IE had even had a chance to render the
> reloaded page!
>
> In any case, it's working now, and I learned quite a bit. I agree that
> the each_with_index should be included - although I'm not sure what the
> preferred index behaviour should be. Perhaps that's why it's not in
> there now?
>
> Thanks again,
> Ian
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ethan Jewett
> Sent: Tuesday, May 08, 2007 9:18 AM
> To: wtr-general@rubyforge.org
> Subject: Re: [Wtr-general] Using an ie.table.each do |row| loop when
> thepagein the ie window refreshes itself
>
> Ian,
>
> Sorry about the "rows" and "each_with_index" issues.  Hopefully
> that'll teach me to test suggestions : )
>
> table(:index,29) clearly does the same thing I thought
> table(:index,29).rows does.
>
> As for the "each_with_index", if you just mixin the Enumerable module
> to the Watir::Table class like this:
>
> class Watir::Table
>   include Enumerable
> end
>
> before you use "each_with_index", then you should be in good shape.
> This seems like something that should be added to the base Watir,
> since rows in a table are generally an enumerable element and the
> current Watir::Table.each method returns the rows of the table in
> order.
>
> Any objections?  If not, I'll open a ticket.
>
> Ethan
>
> On 5/7/07, Ian Webb <[EMAIL PROTECTED]> wrote:
> > Thanks - this does look like a good approach. The table's layout
> doesn't
> > change, it just reloads to update the data within the table with the
> > entries that were just made in the popup window. It's a really
> annoying
> > UI, especially when you have test cases that require changing a dozen
> > rows and therefore opening the popup a dozen times.. hence why I'm
> quite
> > eager to get Watir doing it instead.
> >
> > However, each_with_index appears to be an undefined method for
> ie.table
> > objects. I can iterate on .each just fine, but .each_with_index is
> > undefined. (.rows is undefined as well; .each works fine if I leave it
> > out)
> >
> > I'm wondering if maybe there's a way to store the indices of the
> buttons
> > it's going to click on within the array, rather than the rows
> > themselves. I tried buttons_to_click << row[5].link(:index,1), but
> that
> > doesn't work.
> >
> > Thanks,
> > Ian
> >
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Ethan Jewett
> > Sent: Saturday, May 05, 2007 6:55 PM
> > To: wtr-general@rubyforge.org
> > Subject: Re: [Wtr-general] Using an ie.table.each do |row| loop when
> > thepage in the ie window refreshes itself
> >
> > Ian,
> >
> > Reloading probably invalidates the table object, resulting in your
> > "Access denied" error when ruby goes back for the next row in the
> > table.
> >
> > Suggestion:  Assuming that submitting and reloading doesn't affect the
> > table layout, use rows.each_with_index to build an array of indices of
> > relevant rows.  Then cycle through the array clicking and submitting.
> > For instance (untested, unfortunately):
> >
> > rows_to_click = Array.new
> >
> > ie.table(:index, 29).rows.each_with_index do |row, i|
> >   rows_to_click << i if (row[1].text =~ /#{journals}/) != nil
> > end
> >
> > rows_to_click.each do |i|
> >   [Do the clicking and such for row i here.]
> > end
> >
> > This could be made substantially prettier, but hopefully it gets the
> job
> > done.
> >
> > Ethan
> >
> > On 5/4/07, Ian Webb <[EMAIL PROTECTED]> wrote:
> > > Here's the code snippet that's giving me problems:
> > >
> > >   ie.table(:index,29).each do |row|
> > > if (row[1].text =~ /#{journals}/) != nil then #If there is a
> match
> > > for that regex
> > >   row[5].link(:index,1).click # this makes the popup window
> appear
> > >   cw = Watir::IE.attach(:title,'Popup Window') # attach to the
> > popup
> > > window
> > >   doRolesPopup(cw) # fill out and submit the form
> > > end
> > >   end
> > >
> > > doRolesPopup fills out a form in the cw page, then clicks submit.
> The
> > > submit button submits the form, then closes the cw window and
> reloads
> > > the ie window. This reload of the page referenced by the ie object
> > > appears to break the row object, since I get the following error:
> > >
> > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `invoke': unknown
> > > property or method 

Re: [Wtr-general] The Plan for Watir

2007-05-09 Thread Bret Pettichord
Chris McMahon wrote:
> There might still be enough there to work with.
> This is a port of Perl Win32::GuiTest, btw
That is good to hear. Since a release was never made, i had assumed that 
it was an abandoned project. I just took another look and found i was 
able to run all the tests successfully.

 From what you say, i would say that the next step would be to package 
this as a gem and create some rdoc, even if it was only something simple 
that pointed you to the corresponding perl docs.

I was also confused by the guitest020218 directory. Should i just ignore 
this? There are duplicates of several files (cguitest.so, guitest.rb). 
Which is the correct one to use?

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


Re: [Wtr-general] The Plan for Watir

2007-05-09 Thread Chris McMahon
On 5/9/07, Bret Pettichord <[EMAIL PROTECTED]> wrote:
> Paul Rogers wrote:
> > Id like the winclicker code to disappear and be replaced by a full windows 
> > testing library ( How you getting along with that Chris ? ). Enough people 
> > seem to want it.
> >
> I think a lot of people would like to see that. I certainly would. But
> last i looked Chris's project hadn't seen a commit in 18 months.

There might still be enough there to work with.
This is a port of Perl Win32::GuiTest, btw.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Watir Data types exported from excel

2007-05-09 Thread Tunde Jinadu

I'm running a script to read data from a spreadsheet using the following
script

# open the spreadsheet and get the values
   excel = WIN32OLE::new('excel.Application') # define the type of
application to connect too
   workbook = excel.Workbooks.Open('d:\Smoke_Test2.xls') # spreadsheet
location
   worksheet = workbook.Worksheets(1) #get hold of the second worksheet
   worksheet.Select  #bring it to the front -need sometimes to run macros,
not for working with a worksheet from ruby
   range=worksheet.range("a1", "bw50") # range of spreadsheet
   #~ excel['Visible'] = false #make visible, set to false to make
invisible again. Don't need it to be visible for script to work


the value I am picking out of the spreadsheet is a number



using the following

ie.text_field
(:id,/AccountNumber/).set(spreadsheetdata[:'accountnumber'].to_i)

when the script enters data into the field it attempts to enter data as
follows .0 (decimal place materialises.)

I think ruby changes the format of the number 111 extracted from the
spreadsheet from an integer as specified using .to_i to another format
(hence the decimal place being displayed in the form field) How can I ensure
the format of the data extracted from excel stays as an integer or text,
allowing a leading zero as '0111' or ''








--
The second half of a man's life is made up of nothing but the habits he has
acquired during the first half.
 - Fyodor Dostoevsky
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] The Plan for Watir

2007-05-09 Thread Bret Pettichord
Paul Rogers wrote:
> Id like the winclicker code to disappear and be replaced by a full windows 
> testing library ( How you getting along with that Chris ? ). Enough people 
> seem to want it. 
>   
I think a lot of people would like to see that. I certainly would. But 
last i looked Chris's project hadn't seen a commit in 18 months.

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


Re: [Wtr-general] Problem retrieving data from an Ajax page

2007-05-09 Thread Željko Filipin

Try Internet Explorer Developer Toolbar (
http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en).
It should show actual content of the page, not source. I have tried it, but
I have not used it a lot, but I have heard that it can help with ajax pages.

Zeljko
--
ZeljkoFilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] find min/max values in an array of floats

2007-05-09 Thread Bernard Kenik

> Message: 4
> Date: Tue, 8 May 2007 23:18:00 -0600
> From: "Chris McMahon" <[EMAIL PROTECTED]>
> Subject: [Wtr-general] OT: find min/max values in an array of floats
> To: wtr-general@rubyforge.org
> Message-ID:
>   <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> I can think of a couple of ways to do this, but they're all painful in
> one way or another.  Ruby being Ruby, I wonder if there's some nifty
> shortcut.  Given
>
> floats = []
> floats << 3.456
> floats << 1.53
> floats << 5.123
>
> show that the least element of the array is 1.53 and the greatest
> element of the array is 5.123, where the array "floats" can have an
> arbitrarily large number of elements, of which all are (of course)
> numbers with decimal values.
>
>
>   
floats.sort!.last  should get the maximum float value

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


[Wtr-general] Problem retrieving data from an Ajax page

2007-05-09 Thread Lavanya
Hi All, 

I am new to watir. 

I am automating a web configuration page wherein I fill the contents with 
different values and upon running the selection, the result page pops up. 

However when i do a view source of the result page it doesn't show me the 
latest result page value however in the view source i see the contents of 
configuration page. 

The reason for this is that the result page is Ajax based. 

My actual aim is to verify the result that appears. 

How do i do it with page source not bringing up the contents?

Appreciate u r help

Thanks,
Lavanya
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] The Plan for Watir

2007-05-09 Thread Paul Rogers
Id like the winclicker code to disappear and be replaced by a full windows 
testing library ( How you getting along with that Chris ? ). Enough people seem 
to want it. 

Paul


- Original Message -
From: Bret Pettichord <[EMAIL PROTECTED]>
Date: Wednesday, May 9, 2007 1:40 pm
Subject: Re: [Wtr-general] The Plan for Watir

> Christopher Rasch wrote:
> >> Both of these tickets relate to improving the existing modal 
> web dialog 
> >> support (showModalDialog). At this point, I no longer have 
> plans to work 
> >> on them and no one else has volunteered to work on them. 
> Probably the 
> >> biggest problem with our current support for showModalDialog is 
> that it 
> >> only works with Ruby 1.8.2. Fixing this would require that 
> IEDialog.dll 
> >> be rewritten as an activex component.
> >> 
> >
> > Doesn't WET already handle modal dialogs pretty well?  
> Yes, i believe it does.
> > What would be
> > involved in integrating WET's functionality into Watir?
> >   
> Some programming and testing. And apparently more than any one is 
> willing to do.
> >>> Provide cleaner interface and more reliable support for modal 
> windows>>> dialogs (i.e. replace winClicker.rb)
> >>> http://jira.openqa.org/browse/WTR-4  
> >>>   
> >> Although this is desirable and many people have talked about 
> helping 
> >> with this, we've seen few actual contributions. Personally, i 
> have 
> >> almost always found ways to avoid these dialogs, so I have 
> never had 
> >> much motivation to fix this myself.
> >> 
> >
> > I would like to help, but I don't feel competent enough yet to 
> do any
> > good.  I'd imagine that others probably feel the same way.  
> Perhaps it
> > would help attract more help if there were some tutorials on the
> > architecture of watir?
> >   
> First of all, this code has nothing to do with "the architecture 
> of 
> watir". It is basically standalone and separate.
> 
> Your suggestion seems to assume that I am trying to attract more 
> help. 
> Actually, I'm mostly inclined to remove this code from Watir or 
> else 
> move to a separate contrib project. I think the best way to 
> attract 
> support would be be make it clear that this is abandoned code.
> 
> For the record, i do not have a good understanding of this code. 
> I've 
> never worked on it. And i don't use it.
> 
> But if you are able to convince somebody to write up a tutorial on 
> how 
> this code works (or doesn't) then that would be great. Just don't 
> look 
> at me.
> 
> At one point (like when i opened the jira ticket) i thought i 
> might 
> eventually get around to cleaning up this code. I no longer think 
> this 
> is likely.
> 
> >> The show_modal_dialog support in watir 1.5 is specific to IE. 
> So no. It 
> >> would be handy to have a better windows library for handling 
> general 
> >> windows dialogs, and if we had that, then it would also help 
> for firefox 
> >> -- you could use it there too, although I know that Angrez is 
> focussing 
> >> on features that would not be platform specific. All of the 
> mechanisms 
> >> that we currently using in Watir (autoit, winclicker, win32api) 
> are 
> >> windows specific, so known of them would be migrated to other 
> platforms.>> 
> >
> > Is there a design document for what such a library should have?
> >   
> No i don't believe so.
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
> 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] The Plan for Watir

2007-05-09 Thread Bret Pettichord
Christopher Rasch wrote:
>> Both of these tickets relate to improving the existing modal web dialog 
>> support (showModalDialog). At this point, I no longer have plans to work 
>> on them and no one else has volunteered to work on them. Probably the 
>> biggest problem with our current support for showModalDialog is that it 
>> only works with Ruby 1.8.2. Fixing this would require that IEDialog.dll 
>> be rewritten as an activex component.
>> 
>
> Doesn't WET already handle modal dialogs pretty well?  
Yes, i believe it does.
> What would be
> involved in integrating WET's functionality into Watir?
>   
Some programming and testing. And apparently more than any one is 
willing to do.
>>> Provide cleaner interface and more reliable support for modal windows
>>> dialogs (i.e. replace winClicker.rb)
>>> http://jira.openqa.org/browse/WTR-4  
>>>   
>> Although this is desirable and many people have talked about helping 
>> with this, we've seen few actual contributions. Personally, i have 
>> almost always found ways to avoid these dialogs, so I have never had 
>> much motivation to fix this myself.
>> 
>
> I would like to help, but I don't feel competent enough yet to do any
> good.  I'd imagine that others probably feel the same way.  Perhaps it
> would help attract more help if there were some tutorials on the
> architecture of watir?
>   
First of all, this code has nothing to do with "the architecture of 
watir". It is basically standalone and separate.

Your suggestion seems to assume that I am trying to attract more help. 
Actually, I'm mostly inclined to remove this code from Watir or else 
move to a separate contrib project. I think the best way to attract 
support would be be make it clear that this is abandoned code.

For the record, i do not have a good understanding of this code. I've 
never worked on it. And i don't use it.

But if you are able to convince somebody to write up a tutorial on how 
this code works (or doesn't) then that would be great. Just don't look 
at me.

At one point (like when i opened the jira ticket) i thought i might 
eventually get around to cleaning up this code. I no longer think this 
is likely.

>> The show_modal_dialog support in watir 1.5 is specific to IE. So no. It 
>> would be handy to have a better windows library for handling general 
>> windows dialogs, and if we had that, then it would also help for firefox 
>> -- you could use it there too, although I know that Angrez is focussing 
>> on features that would not be platform specific. All of the mechanisms 
>> that we currently using in Watir (autoit, winclicker, win32api) are 
>> windows specific, so known of them would be migrated to other platforms.
>> 
>
> Is there a design document for what such a library should have?
>   
No i don't believe so.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Sample Training Presentation and Exercises posted on Wiki

2007-05-09 Thread Bret Pettichord
Chris McMahon wrote:
> The Scripting101 course could use some enhancement.  I'm just sayin'...
> http://rubyforge.org/frs/?group_id=104
>   
I am actually in the process of rewriting this using the Depot/Rails 
test application.

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


Re: [Wtr-general] how to include external script (.rb) in Watir?

2007-05-09 Thread Željko Filipin

On 5/5/07, Alien Ruby <[EMAIL PROTECTED]> wrote:


How are you guys so helpful ?



We get a lot of chunky bacon for every correct answer. :)

Zeljko
--
ZeljkoFilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] The Plan for Watir

2007-05-09 Thread Christopher Rasch
Thanks for your detailed response!

Bret Pettichord wrote:

> Watir 1.5 supports the modal_dialog command which supports #2 above. A 
> good argument could be made that it needs to have a more-specific name.
>> And here:
>>
>> Deliver new DLL that allows us to access DOM embedded in modal web dialogs
>> http://jira.openqa.org/browse/WTR-14
>>
>> WIN32OLE patch for Modal Web Dialog Support
>> http://jira.openqa.org/browse/WTR-2
>>   
> Both of these tickets relate to improving the existing modal web dialog 
> support (showModalDialog). At this point, I no longer have plans to work 
> on them and no one else has volunteered to work on them. Probably the 
> biggest problem with our current support for showModalDialog is that it 
> only works with Ruby 1.8.2. Fixing this would require that IEDialog.dll 
> be rewritten as an activex component.

Doesn't WET already handle modal dialogs pretty well?  What would be
involved in integrating WET's functionality into Watir?


>>  Provide cleaner interface and more reliable support for modal windows
>> dialogs (i.e. replace winClicker.rb)
>> http://jira.openqa.org/browse/WTR-4
>>   
> Although this is desirable and many people have talked about helping 
> with this, we've seen few actual contributions. Personally, i have 
> almost always found ways to avoid these dialogs, so I have never had 
> much motivation to fix this myself.

I would like to help, but I don't feel competent enough yet to do any
good.  I'd imagine that others probably feel the same way.  Perhaps it
would help attract more help if there were some tutorials on the
architecture of watir?


>> Since integration of the various watirs is also part of the roadmap, I
>> expect that some of the better modal dialog support will also be
>> migrated to the other watir flavors.   Perhaps I have the wrong impression?
>>   
> The show_modal_dialog support in watir 1.5 is specific to IE. So no. It 
> would be handy to have a better windows library for handling general 
> windows dialogs, and if we had that, then it would also help for firefox 
> -- you could use it there too, although I know that Angrez is focussing 
> on features that would not be platform specific. All of the mechanisms 
> that we currently using in Watir (autoit, winclicker, win32api) are 
> windows specific, so known of them would be migrated to other platforms.


Is there a design document for what such a library should have?

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


Re: [Wtr-general] Sample Training Presentation and Exercises posted on Wiki

2007-05-09 Thread Chris McMahon
On 5/9/07, Brown, David <[EMAIL PROTECTED]> wrote:
>  In case anyone can re-use them, I've posted a basic Watir training
> presentation and some associated exercises that I've developed and used
> a few times to train individuals & groups in my company on the basics of
> Watir. Feel free to re-use, modify and enhance them :).
> http://wiki.openqa.org/display/WTR/Watir+Training+Presentation+and+Exerc
> ises
>

The Scripting101 course could use some enhancement.  I'm just sayin'...
http://rubyforge.org/frs/?group_id=104
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Sample Training Presentation and Exercises posted on Wiki

2007-05-09 Thread Brown, David
 In case anyone can re-use them, I've posted a basic Watir training
presentation and some associated exercises that I've developed and used
a few times to train individuals & groups in my company on the basics of
Watir. Feel free to re-use, modify and enhance them :).
http://wiki.openqa.org/display/WTR/Watir+Training+Presentation+and+Exerc
ises

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


Re: [Wtr-general] Community involvement with Watir

2007-05-09 Thread aidy lewis
On 09/05/07, Bret Pettichord <[EMAIL PROTECTED]> wrote:

> Just to be clear, we have always been open to having people add these to
> our wiki and have often encouraged this.
>
> http://wiki.openqa.org/display/WTR/Contributions
>
> Bret

I think all these important links should become a footnote on Watir's
main page.
A page that could link to every major contribution, Watir assets have
become too amorphous.

Also additional user-guide sugesstions

IDE's: Arachno, Eclipse, Emacs
Test Frameworks: Data-driven, test DSL's?, object mapping, Test::Unit
Test Reports: I have written some XML + XLST = HTML. I will put it on the FAQ's.

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


Re: [Wtr-general] Community involvement with Watir

2007-05-09 Thread Charley Baker

I'm all for a Why style guide. His surreal style sucks more people in than
if it was a plain old manual. Maybe a donut eating platypus instead of
foxes. :)

-c

On 5/9/07, Bret Pettichord <[EMAIL PROTECTED]> wrote:


Željko Filipin wrote:
>
> Watir user guide can have "enterprise look", but I would also like to
> create one version with cartoon characters. I am sure there are lots
> of creative people here and I hope they will show their creativity. If
> you would not like to see cartoon characters in Watir user guide,
> please do let me know, I will not put it at Watir Wiki. (I will put it
> at my blog and smile to my jokes. Alone.)
>
Chunky Bacon!
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Community involvement with Watir

2007-05-09 Thread Bret Pettichord
Željko Filipin wrote:
>
> Watir user guide can have "enterprise look", but I would also like to 
> create one version with cartoon characters. I am sure there are lots 
> of creative people here and I hope they will show their creativity. If 
> you would not like to see cartoon characters in Watir user guide, 
> please do let me know, I will not put it at Watir Wiki. (I will put it 
> at my blog and smile to my jokes. Alone.)
>
Chunky Bacon!
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Ataaching to windows on slow network connections

2007-05-09 Thread Bret Pettichord
Dhrubojyoti Biswas wrote:
> I am eager to know if there is a better way to do this?
Use Watir 1.5. This problem is fixed there. You can look at the 
repository on openqa if you want details.

Bret

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


Re: [Wtr-general] Having trouble capturing text in java alert

2007-05-09 Thread gary
Thanks for the prompt reply.

I added the code but it appears to return a value of 'Google', any ideas?

require 'watir'   # the controller
include Watir
require 'watir/WindowHelper'
require 'test/unit' 
require 'test/unit/ui/console/testrunner'
require 'dl/win32'
require 'watir/winClicker'

class TC_recorded < Test::Unit::TestCase

  def startClicker( button , waitTime = 3)
  w = WinClicker.new
  longName = @IE0.dir.gsub("/" , "\\" )
  shortName = w.getShortFileName(longName)
  c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button } #{waitTime} 
"
  puts "Starting #{c}"
  w.winsystem(c)
  w=nil
  end

  def test_1
  @IE0 = IE.new
  @IE0.set_fast_speed
  @IE0.goto("www.hmv.co.uk")
  @IE0.link(:text, "Sign In").click
  
  w = WinClicker.new
  text = w.get_static_text('Windows Internet Explorer') # returns an array for 
each static control
  text.each {|t| puts t}

  startClicker("OK" , 3)
  @IE0.image(:alt, "continue").click

  
  @IE0.close   
  end
end
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] The Plan for Watir

2007-05-09 Thread Bret Pettichord
Thanks for your detailed replies. Comments inline.

Christopher Rasch wrote:
> Well, ultimately, I want to be able to handle any popup that the browser
> throws up: attach to it, manipulate it, etc. My understanding is
> that better modal dialog support is  one of the new features of Watir
> 1.5.  See here:
>
> http://wiki.openqa.org/display/WTR/Watir+1.5+Summary
>   
Right. We added support for handling the IE-specific showModalDialog() 
in Watir 1.5. As Chris said, there is a terminology problem.

Technically, any dialog that blocks access to the main page while it is 
posted is modal. There are many technologies that allow this.
1. Javascript alert() and confirm()
2. The showModalDialog() mentioned above
3. Various security and authentication dialogs
4. File dialogs such as save as.
5. More recently, there are ajax modal dialogs that appear within the page.

Watir 1.5 supports the modal_dialog command which supports #2 above. A 
good argument could be made that it needs to have a more-specific name.
> And here:
>
> Deliver new DLL that allows us to access DOM embedded in modal web dialogs
> http://jira.openqa.org/browse/WTR-14
>
> WIN32OLE patch for Modal Web Dialog Support
> http://jira.openqa.org/browse/WTR-2
>   
Both of these tickets relate to improving the existing modal web dialog 
support (showModalDialog). At this point, I no longer have plans to work 
on them and no one else has volunteered to work on them. Probably the 
biggest problem with our current support for showModalDialog is that it 
only works with Ruby 1.8.2. Fixing this would require that IEDialog.dll 
be rewritten as an activex component.
>  Provide cleaner interface and more reliable support for modal windows
> dialogs (i.e. replace winClicker.rb)
> http://jira.openqa.org/browse/WTR-4
>   
Although this is desirable and many people have talked about helping 
with this, we've seen few actual contributions. Personally, i have 
almost always found ways to avoid these dialogs, so I have never had 
much motivation to fix this myself.
> Since integration of the various watirs is also part of the roadmap, I
> expect that some of the better modal dialog support will also be
> migrated to the other watir flavors.   Perhaps I have the wrong impression?
>   
The show_modal_dialog support in watir 1.5 is specific to IE. So no. It 
would be handy to have a better windows library for handling general 
windows dialogs, and if we had that, then it would also help for firefox 
-- you could use it there too, although I know that Angrez is focussing 
on features that would not be platform specific. All of the mechanisms 
that we currently using in Watir (autoit, winclicker, win32api) are 
windows specific, so known of them would be migrated to other platforms.

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


Re: [Wtr-general] Having trouble capturing text in java alert

2007-05-09 Thread Charley Baker

w = WinClicker.new
text =  w.get_static_text('Microsoft Internet Explorer') # returns an array
for each static control
text.each {|t| puts t}


-Charley

On 5/9/07, gary <[EMAIL PROTECTED]> wrote:


Hi everyone,

I'm having difficulty in capturing the text from a java alert, and would
appreciate anyones input.

Using AutoIT, for the pop up window works a treat, allowing me to capture
the text, and then select the OK button to proceed with the script:

require 'watir'   # the controller
include Watir
require 'watir/WindowHelper'
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'dl/win32'

class TC_recorded < Test::Unit::TestCase

def check_for_popups
autoit = WIN32OLE.new('AutoItX3.Control')
  loop do
  sleep(3)
  ret = autoit.WinWait('Security Information', '', 1)
  text = autoit.WinGetText('Security Information', '')
  if (ret==1)
  puts text
  else
  puts "where is it?"
  end
  if (ret==1) then autoit.Send('{Yes}') end
  sleep(2)
  end
end


  def test_1
  @IE0 = IE.new
  @IE0.set_fast_speed
  @IE0.goto("
http://hmvdigital.co.uk/HMV.Digital.OnlineStore.Portal/Pages/Home.aspx";)
  @IE0.link(:text, "Sign in").click

  @popup = Thread.new { check_for_popups }  # start popup handler
  @IE0.link(:href, "
https://hmvdigital.co.uk/HMV.Digital.OnlineStore.Portal/Pages/HelpPopup.aspx?category=Managing_your_account&link=AboutRememberMe
").click
  Thread.kill(@popup) # end popup handler

  @IE0.close
  end
end

Unfortunately I have been unable to use AutoIt in dealing with an alerts,
and have been using winClicker. I am able to select the OK button to
proceed, but unable to capture any text:

require 'watir'   # the controller
include Watir
require 'watir/WindowHelper'
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'dl/win32'
require 'watir/winClicker'

class TC_recorded < Test::Unit::TestCase

  def startClicker( button , waitTime = 3)
  w = WinClicker.new
  longName = @IE0.dir.gsub("/" , "\\" )
  shortName = w.getShortFileName(longName)
  c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button }
#{waitTime} "
  puts "Starting #{c}"
  w.winsystem(c)
  w=nil
  end

  def test_1
  @IE0 = IE.new
  @IE0.set_fast_speed
  @IE0.goto("www.hmv.co.uk")
  @IE0.link(:text, "Sign In").click
  startClicker("OK" , 3)
  @IE0.image(:alt, "continue").click
  @IE0.close
  end
end

As previously mentioned, any help would be greatly appreciated, many
thanks
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

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

Re: [Wtr-general] Ataaching to windows on slow network connections

2007-05-09 Thread Chris McMahon
Untested, but this will try to attach every two seconds forever:


def get_popup

  begin
ie.attach(:title, "My Window)
  rescue
sleep 2
get_popup
end

end
##


You could put your counter in there with an exit clause.


On 5/9/07, Dhrubojyoti Biswas <[EMAIL PROTECTED]> wrote:
> Time and again I have faced issues where the WATIR attach method, that
> returns a handle to a popup window, has misbehaved.
>
> Specifically I have noticed this on somewhat slow connections. In Cases
> where the pop up windows take some time to get rendered on the client
> machine, the attach method throws an exception saying that it coud not find
> the window.
>
> I have been using WATIR 1.4.x extensively for my projects.
>
> I came up with this small solution that would grab the window no matter how
> slow the connection is. Can someone think of a better way to do it, or does
> this solution look viable?
>
> def GTools.waitForPopUp(ie, title)
> iePopUp = ''
> popupGrabber = false
> popupGrabberCounter = 0
>   #I'll wait for the popup to come up... I'll make some iterations and
> then I'll stop iterating
>   #Ideally the number of iterations to be made should be made
> configurable (number 21)
> while(popupGrabber == false && popupGrabberCounter <= 21)
>   begin
> rxp = Regexp.new (title)
> iePopUp = Watir::IE.attach(:title, rxp)
> # I will reach this point only if attach does not throw an
> exception
> popupGrabber = true
>   rescue Exception => ex
>   # If the code reaches this block it means that the pop up window
> that
>   # u were trying to grab using attach was not served up by the
> WebServer
>   # set the Grabber flag to false and return back into the loop
> print "Rescued Exception\n"
> popupGrabber = false
>   end
>   popupGrabberCounter = popupGrabberCounter + 1
>   if(popupGrabberCounter >= 21)
> raise GUIException("PopUp Timeout No PopUp Window having
> title " + title + " was found")
>   end
>   return iePopUp
> end
>
> When I use this workaround method I have noticed that the code enters the
> rescue block quite anumber of times before it attaches successfully to the
> window.
>
> I am eager to know if there is a better way to do this?
>
> --
> Dhruv
>
>
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Having trouble capturing text in java alert

2007-05-09 Thread gary
Hi everyone,

I'm having difficulty in capturing the text from a java alert, and would 
appreciate anyones input.

Using AutoIT, for the pop up window works a treat, allowing me to capture the 
text, and then select the OK button to proceed with the script:

require 'watir'   # the controller
include Watir
require 'watir/WindowHelper'
require 'test/unit' 
require 'test/unit/ui/console/testrunner'
require 'dl/win32'

class TC_recorded < Test::Unit::TestCase

def check_for_popups
autoit = WIN32OLE.new('AutoItX3.Control')
  loop do
  sleep(3)
  ret = autoit.WinWait('Security Information', '', 1)
  text = autoit.WinGetText('Security Information', '')
  if (ret==1) 
  puts text
  else
  puts "where is it?"
  end
  if (ret==1) then autoit.Send('{Yes}') end
  sleep(2)
  end
end
  
 
  def test_1
  @IE0 = IE.new
  @IE0.set_fast_speed
  
@IE0.goto("http://hmvdigital.co.uk/HMV.Digital.OnlineStore.Portal/Pages/Home.aspx";)
  @IE0.link(:text, "Sign in").click
  
  @popup = Thread.new { check_for_popups }  # start popup handler
  @IE0.link(:href, 
"https://hmvdigital.co.uk/HMV.Digital.OnlineStore.Portal/Pages/HelpPopup.aspx?category=Managing_your_account&link=AboutRememberMe";).click
  Thread.kill(@popup) # end popup handler
  
  @IE0.close
  end
end

Unfortunately I have been unable to use AutoIt in dealing with an alerts, and 
have been using winClicker. I am able to select the OK button to proceed, but 
unable to capture any text:

require 'watir'   # the controller
include Watir
require 'watir/WindowHelper'
require 'test/unit' 
require 'test/unit/ui/console/testrunner'
require 'dl/win32'
require 'watir/winClicker'

class TC_recorded < Test::Unit::TestCase

  def startClicker( button , waitTime = 3)
  w = WinClicker.new
  longName = @IE0.dir.gsub("/" , "\\" )
  shortName = w.getShortFileName(longName)
  c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button } #{waitTime} 
"
  puts "Starting #{c}"
  w.winsystem(c)
  w=nil
  end

  def test_1
  @IE0 = IE.new
  @IE0.set_fast_speed
  @IE0.goto("www.hmv.co.uk")
  @IE0.link(:text, "Sign In").click
  startClicker("OK" , 3)
  @IE0.image(:alt, "continue").click
  @IE0.close   
  end
end

As previously mentioned, any help would be greatly appreciated, many thanks
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Community involvement with Watir

2007-05-09 Thread Željko Filipin

On 5/8/07, Bret Pettichord <[EMAIL PROTECTED]> wrote:


I think one question Zeljko needs to address is what form he wants it to
be. I think he said something about breaking it into separate files,
which is fine. Another option is to migrate it to the wiki, which would
make eat easier to get contributions from others...



I have been thinking a lot about updating Watir user
guidethese days, but I
did not have time to start working. I will have some time
next week (if not before). I think if user guide is migrated to Watir
Wikiit would make
contributions much easier, so I plan to do that. If anybody
would like to start working on user guide before I migrate it to Wiki, go
ahead and grab it from Watir SVN
repository, make Wiki page and start
working. If you do not know how
to get it from SVN repository  or how
to create Wiki 
page,
please let me know.

I received a lot of good advice about updating user guide. There is a clear
need for more documentation on Watir. I do not think that everything should
be in user guide. My plan is to make user guide as short as possible and
provide links to more advanced topics. Something like:

  - Install Ruby.
  - Install Watir.
  - Open IE.
  - Navigate to a page.
  - Click a link.
  - Click a button.
  - Verify some text is there.
  - That was easy!
  - Want to learn more?
  - See how you can work with:
 - Other tags.
 - Various pop-up windows.
 - JavaScript.
 - AJAX.
 - Unit tests (running them, reading them, learning from them).
 - …
  - There is also lots of good documentation on Watir that *is* at our
  site. See:
 - FAQ
 - What is Ruby?
 - What is Watir?
 - Is there a difference?
 - Why should I care?
 - …
  - There is also lots of good documentation on Watir that *is not* at
  our site. Check it out:
 - Articles.
 - Cheat sheets.
 - Books.
 - …
  - Have question? We have mailing list! When posting a question make
  sure that you include:
 - Relevant snippet of your Watir code.
 - Relevant snippet your HTML.
 - Error message that Ruby gave you (if any).
 - See example question.

I think this short tips about posting to mailing list are very important. I
just hope people will read it.

I think we are ready for several Watir tutorials (at least two).

Take Ruby for example. It has
Pickaxebook
that you can have on your desk and not be embarrassed when you boss
takes a look at it. There is also Why's (Poignant) Guide to
Ruby.
I remember how my boss was surprised when he saw Why's book. I am sure he
thought I was joking when I told him that it is a book about programming.
(Hint: cartoon foxes shouting "Chunky bacon!".)

Watir user guide can have "enterprise look", but I would also like to create
one version with cartoon characters. I am sure there are lots of creative
people here and I hope they will show their creativity. If you would not
like to see cartoon characters in Watir user guide, please do let me know, I
will not put it at Watir Wiki. (I will put it at my blog and smile to my
jokes. Alone.)
Zeljko
--
ZeljkoFilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Ataaching to windows on slow network connections

2007-05-09 Thread Dhrubojyoti Biswas

Time and again I have faced issues where the WATIR attach method, that
returns a handle to a popup window, has misbehaved.

Specifically I have noticed this on somewhat slow connections. In Cases
where the pop up windows take some time to get rendered on the client
machine, the attach method throws an exception saying that it coud not find
the window.

I have been using WATIR 1.4.x extensively for my projects.

I came up with this small solution that would grab the window no matter how
slow the connection is. Can someone think of a better way to do it, or does
this solution look viable?

def GTools.waitForPopUp(ie, title)
   iePopUp = ''
   popupGrabber = false
   popupGrabberCounter = 0
 #I'll wait for the popup to come up... I'll make some iterations and
then I'll stop iterating
 #Ideally the number of iterations to be made should be made
configurable (number 21)
   while(popupGrabber == false && popupGrabberCounter <= 21)
 begin
   rxp = Regexp.new(title)
   iePopUp = Watir::IE.attach(:title, rxp)
   # I will reach this point only if attach does not throw an
exception
   popupGrabber = true
 rescue Exception => ex
 # If the code reaches this block it means that the pop up window
that
 # u were trying to grab using attach was not served up by the
WebServer
 # set the Grabber flag to false and return back into the loop
   print "Rescued Exception\n"
   popupGrabber = false
 end
 popupGrabberCounter = popupGrabberCounter + 1
 if(popupGrabberCounter >= 21)
   raise GUIException("PopUp Timeout No PopUp Window having
title " + title + " was found")
 end
 return iePopUp
   end

When I use this workaround method I have noticed that the code enters the
rescue block quite anumber of times before it attaches successfully to the
window.

I am eager to know if there is a better way to do this?

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

Re: [Wtr-general] FireWatir: test/unit assertions can't be found?

2007-05-09 Thread Chris McMahon
> include Test::Unit::Assertions # you need to mix in the assertion
> methods if you want to use them outside of a testcase.

Thanks, got it, I should have seen that.
-C
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Watir + Autoit + Save As

2007-05-09 Thread Maisonnette
Ok,
But I don't want just to save the html code...
When I click on a button, that open a windows popup (a 'save as' window)
that I use to save a file to the HDD.

I tried this but it doesn't work :
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general