[Wtr-general] How to make IE as active windows and capture it?

2007-04-03 Thread Jason He
Dear all,

 

I use a batch script in Windows command prompt (console) to start ruby
scripts, when capture the active window using screen_capture("test.jpg",
true), it will capture the console window rather than the Internet
Explorer, how to make IE as active window and bring it forward by
watir/ruby script?

 

Regards,

Jason

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

[Wtr-general] Alert popups,

2007-04-03 Thread Naga Harish Kanegolla
Hi all, 
  Now i am able to click on the alert popup with watir, i followed the code 
form the FAQ's but later i copied the whole code into another machine, i am 
able to run all the test cases except the alert popup, that is not working in 
another machine, so wat mightbe the problem?? Its giving an error "timed out"
This is my code,

require 'watir\contrib\enabled_popup' 
#
def startClicker( button , waitTime= 9, user_input=nil )
  # get a handle if one exists
  hwnd = $ie.enabled_popup(waitTime)  
  if (hwnd)  # yes there is a popup
w = WinClicker.new
if ( user_input ) 
  w.setTextValueForFileNameField( hwnd, "#{user_input}" )
end
# I put this in to see the text being input it is not necessary to work
sleep 3 
# "OK" or whatever the name on the button is
w.clickWindowsButton_hwnd( hwnd, "#{button}" )
#
# this is just cleanup
w=nil
  end
end
#
# MAIN APPLICATION CODE
#
$ie = Watir::IE.start( "c:\test.htm" )

# This is whatever object that uses the click method.  
# You MUST use the click_no_wait method.
$ie.image( :id, '3' ).click_no_wait
#
# 3rd parameter is optional and is used for input and file dialog boxes.
startClicker( @button, 7 , "User Input" )

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


Re: [Wtr-general] problem in clicking button

2007-04-03 Thread Prema Arya

Hi Vikash,

Sorry, I tested the code with the new version that I am working on.
We will be releasing the next version, around next week-end.
For now you can copy (replace) the files I have attached,  in the firewatir
directory.
The path is normally like "C:\ruby\lib\ruby\gems\1.8\gems\firewatir-
1.0.1-mswin32"

Hope this wil lresolve the problem, untill next week.

Reagrds,
Prema


On 4/3/07, VIKASH KUMAR <[EMAIL PROTECTED] > wrote:


  Hi Prema,

Thanks for your reply, but when I used this
ff.button(:text, "Sign In").click
It throws error, as shown below

irb(main):016:0> ff.button(:text,"Sign In").click
FireWatir::Exception::UnknownObjectException: Unable to locate object,
using text and Sign In
from c:/ruby/lib/ruby/gems/1.8/gems/firewatir- 
1.0.1-mswin32/./MozillaBaseElement.rb:739:in
`assert_exists'
from 
c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.0.1-mswin32/./MozillaBaseElement.rb:897:in
`click'
also, while using this
ff.button(:type, "submit")

It throws the following error
irb(main):015:0> ff.button(:type,"submit").click
FireWatir::Exception::UnknownObjectException: Unable to locate object,
using type and submit
from c:/ruby/lib/ruby/gems/1.8/gems/firewatir- 
1.0.1-mswin32/./MozillaBaseElement.rb:739:in
`assert_exists'
from 
c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.0.1-mswin32/./MozillaBaseElement.rb:897:in
`click'

Thanks and Regards,
Vikash

> Please, help me in clicking this button using FireWatir
>Sign In

--
Here's a new way to find what you're looking for - Yahoo! Answers


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





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

Re: [Wtr-general] Stable version for watir and ruby

2007-04-03 Thread rkkanneganti
2)Install Watir 1.4.1 using the one click installer .

when you are installing the watir 1.5.1.1158, watir 1.4.1 is not required. You 
can uninstall it. Just download the latest watir Gem and follow the steps 
provided with it and install according to it. I hope this helps.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] OT: Thoughtworks planning to release a tool for application testers

2007-04-03 Thread Prem

On 4/3/07, Chris McMahon <[EMAIL PROTECTED]> wrote:


TW is about to release this thing called "Mingle" to manage agile
projects.  Today they announced an upcoming tool for testers:
http://studios.thoughtworks.com/2007/4/2/how-our-testers-use-mingle
(see the last paragraph).



It seems to be what I have already got after combining TestLink, Mantis,
Docuwiki, Subversion & Scumbug.
Ofcourse my setup needs a bit of integration efforts :(
--
- Prem

 I spent a minute looking at my own code by accident.
 I was thinking "What the hell is this guy doing?"
 
 Prem Kumar Aparanji
 M: 00919845226618
 [Bangalore, KA, INDIA]

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

Re: [Wtr-general] Stable version for watir and ruby

2007-04-03 Thread Sayali Patil

Hi ,
I had asked for the stable version of Watir and Ruby becuse i was getting
the Access Denied error with the
latest versions .
But when i installed Ruby 1.8.5  and  watir 1.5.1.1158 i still keep getting
the same error .
I think i m not installing it the right way ,please go through the following
steps and let me
know if i m going the right way ,

1)Install Ruby 1.8.5 using the one click installer for Ruby .
2)Install Watir 1.4.1 using the one click installer .
3)Extract the watir gem for 1.5.1.1158 using gem install watir command .

Kindly let me know if i m missing something .

Thanks,
Sayali



On 4/4/07, rkkanneganti <[EMAIL PROTECTED]> wrote:


yep Ruby 1.8.5  and  watir 1.5.1.1158. They are working fine.
___
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] OT: Thoughtworks planning to release a tool for application testers

2007-04-03 Thread rkkanneganti
Good info :)
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Stable version for watir and ruby

2007-04-03 Thread rkkanneganti
yep Ruby 1.8.5  and  watir 1.5.1.1158. They are working fine.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] win32/process question

2007-04-03 Thread Paul Rogers

if you make you jclicker.rb write a file or something in the loop, then when 
you run it as a process, you should see the extra files get created.

The problem may also be something to do with the stdout and stderr of ruby when 
running as a process.

I tried using the process for a different purpose to you, and gave up. 

console windows may look ugly, but they make it easy to see what the problems 
are...

- Original Message -
From: matt <[EMAIL PROTECTED]>
Date: Tuesday, April 3, 2007 2:37 pm
Subject: [Wtr-general] win32/process question

> I'm having problems with the win32/process Process.create() 
> method.  The following link is very useful...
> 
> http://textsnippets.com/posts/show/829
> 
> The issue, I think, is with finding the file to launch with the 
> Process.create() method.  
> 
> [jclicker.rb]
> require "watir"
> 
> # Auto Popup Handler. Posted by [EMAIL PROTECTED]
> #
> require 'win32ole'  # already included if you use 'require watir'
> 
> begin
>   autoit = WIN32OLE.new('AutoItX3.Control')
>   loop do
>   autoit.ControlClick("Microsoft Internet Explorer",'', 'OK')
>   autoit.ControlClick("Security Information",'', '&Yes')
>   autoit.ControlClick("Security Alert",'', '&Yes')
>   sleep(5)
>   end
>   
> rescue Exception => e
>   puts e
> end
> 
> 
> If I run this script directly 'ruby jclicker.rb', then any 
> javascript popup windows will "magically" click away.  It works 
> really cool!  However, if I use the win32/process library to 
> create a process while running a test, then the popup handler 
> doesn't run.
> 
> [runtest.rb]
> require 'win32/process'
> $pid = Process.create(
>   :app_name => 'ruby jclicker.rb',
>   :creation_flags  => Process::DETACHED_PROCESS
> ).process_id
> at_exit{ Process.kill(9,$pid) }
> 
> class TC_NewTest < Test::Unit::TestCase
> 
> ...
> 
> end
> 
> 
> It's as if the process is not getting created.  The jclicker.rb 
> script is in the same directory as the test program.  But, the 
> clicker doesn't run.  Any hints are greatly appreciated.
> ___
> 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] Stable version for watir and ruby

2007-04-03 Thread matt
The following combination works quite well...

Ruby 1.8.5 + watir 1.5.1.1158.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] win32/process question

2007-04-03 Thread matt
I'm having problems with the win32/process Process.create() method.  The 
following link is very useful...

http://textsnippets.com/posts/show/829

The issue, I think, is with finding the file to launch with the 
Process.create() method.  

[jclicker.rb]
require "watir"

# Auto Popup Handler. Posted by [EMAIL PROTECTED]
#
require 'win32ole'  # already included if you use 'require watir'

begin
autoit = WIN32OLE.new('AutoItX3.Control')
loop do
autoit.ControlClick("Microsoft Internet Explorer",'', 'OK')
autoit.ControlClick("Security Information",'', '&Yes')
autoit.ControlClick("Security Alert",'', '&Yes')
sleep(5)
end
   
rescue Exception => e
puts e
end


If I run this script directly 'ruby jclicker.rb', then any javascript popup 
windows will "magically" click away.  It works really cool!  However, if I use 
the win32/process library to create a process while running a test, then the 
popup handler doesn't run.

[runtest.rb]
require 'win32/process'
$pid = Process.create(
:app_name => 'ruby jclicker.rb',
:creation_flags  => Process::DETACHED_PROCESS
).process_id
at_exit{ Process.kill(9,$pid) }

class TC_NewTest < Test::Unit::TestCase

...

end


It's as if the process is not getting created.  The jclicker.rb script is in 
the same directory as the test program.  But, the clicker doesn't run.  Any 
hints are greatly appreciated.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Can we use as many variable names without worrying about memory wastage

2007-04-03 Thread Charley Baker

You shouldn't have to invoke the garbage collector manually as it runs
automatically, most often when ruby is allocating memory and it's internal
memory tracker says there isn't any available or if allocating memory fails.


-Charley

On 4/3/07, vijay <[EMAIL PROTECTED]> wrote:


Thanks for all your answers.  They were really helpful to me.  One small
question, do we need to invoke "Garbage Collector" explictly and if so, how?

Thanks,
Vijay.
___
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] OT: Thoughtworks planning to release a tool for application testers

2007-04-03 Thread Chris McMahon
TW is about to release this thing called "Mingle" to manage agile
projects.  Today they announced an upcoming tool for testers:
http://studios.thoughtworks.com/2007/4/2/how-our-testers-use-mingle
(see the last paragraph).
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Using Until

2007-04-03 Thread Paul Rogers
isnt Jeffs code kind of over kill for this?


def link_there?
  link_text = "Click Me"
  return @ie.link(:text , link_text).exists?
end  


while 1  # add something here to stop infinite loop
  if link_there?
@ie.link(:text , link_text).click?
  else
@ie.link(:text , "Next").click
  end
end



- Original Message -
From: Chris McMahon <[EMAIL PROTECTED]>
Date: Tuesday, April 3, 2007 9:04 am
Subject: Re: [Wtr-general] Using Until

> Aha, so you want to click Google's "Next" button?  Take a look at
> this, it might give you some ideas:
> http://testingjeff.wordpress.com/2007/01/27/creating-methods-on-
> the-flyand-bugs-in-google-phonebook/
> 
> Also, if you are unsure how to address a particular page element, take
> a look at the "unittests" folder in the watir directory.  It will be
> in C:/ruby/lib/ruby... somewhere, depending on whether you did a gem
> install or used the one-click installer.
> 
> On 4/3/07, Nicola Kennedy <[EMAIL PROTECTED]> wrote:
> > Sorry, probably my fault for not being clear about how new I am 
> to this.
> >
> > I want the code to do the following things:
> > 1. Check on page for a link.
> > 2. If link not there, press "Next page"
> > 3. If link there, click on it.
> > 4. When next page reached (if step 2 followed), repeat the 
> action of looking for link/clicking next.
> >
> > Am playing around with code, and have come up with following:
> >
> > link = ie.link(:url, "http://www.freeuk.com";)
> > until link.exists
> > 
> ie.goto("http://www.google.co.uk/search?q=freeuk&hl=en&start=10&sa=N";)>
> > if link.exists = true
> >   ie.goto(link)
> > end
> >
> > Am totally aware that this will not work, but it may give my 
> helpers more idea of the details I want!!
> >
> > Thankyou all in advance, and please help!
> > ___
> > 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 mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] IE nested class of module watir?

2007-04-03 Thread aidy lewis
Hi,

I am unsure why IE is a nested class of the module watir

I was thinking of creating this object hierarchy

IE
ObjectMap
Test

Inheriting the IE class from the ObjectMap class.

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


Re: [Wtr-general] Using Until

2007-04-03 Thread Chris McMahon
Aha, so you want to click Google's "Next" button?  Take a look at
this, it might give you some ideas:
http://testingjeff.wordpress.com/2007/01/27/creating-methods-on-the-flyand-bugs-in-google-phonebook/

Also, if you are unsure how to address a particular page element, take
a look at the "unittests" folder in the watir directory.  It will be
in C:/ruby/lib/ruby... somewhere, depending on whether you did a gem
install or used the one-click installer.

On 4/3/07, Nicola Kennedy <[EMAIL PROTECTED]> wrote:
> Sorry, probably my fault for not being clear about how new I am to this.
>
> I want the code to do the following things:
> 1. Check on page for a link.
> 2. If link not there, press "Next page"
> 3. If link there, click on it.
> 4. When next page reached (if step 2 followed), repeat the action of looking 
> for link/clicking next.
>
> Am playing around with code, and have come up with following:
>
> link = ie.link(:url, "http://www.freeuk.com";)
> until link.exists
> ie.goto("http://www.google.co.uk/search?q=freeuk&hl=en&start=10&sa=N";)
>
> if link.exists = true
>   ie.goto(link)
> end
>
> Am totally aware that this will not work, but it may give my helpers more 
> idea of the details I want!!
>
> Thankyou all in advance, and please help!
> ___
> 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 Until

2007-04-03 Thread Nicola Kennedy
Sorry, probably my fault for not being clear about how new I am to this.

I want the code to do the following things:
1. Check on page for a link.
2. If link not there, press "Next page"
3. If link there, click on it.
4. When next page reached (if step 2 followed), repeat the action of looking 
for link/clicking next.

Am playing around with code, and have come up with following:

link = ie.link(:url, "http://www.freeuk.com";)
until link.exists
ie.goto("http://www.google.co.uk/search?q=freeuk&hl=en&start=10&sa=N";)

if link.exists = true
  ie.goto(link)
end

Am totally aware that this will not work, but it may give my helpers more idea 
of the details I want!!

Thankyou all in advance, and please help!
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Using Until

2007-04-03 Thread John Lolis
I'm not sure how new 'wait_until' is, but if you have it do

wait_until(time_to_wait_in_seconds){ $ie.element(:type,'value').exists? }
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Using Until

2007-04-03 Thread Chris McMahon
> I'm trying to put a loop in a script where it checks for a link on a page, if 
> the link isn't there, it clicks on the next page button, looks for the link 
> again, and the process repeats until it finds the link, and then clicks on it.

It'd be easier to help if you would post a) the HTML involved and b)
the Watir code you've tried so far.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Assert Dates?

2007-04-03 Thread Chris McMahon
On 4/3/07, Fletch <[EMAIL PROTECTED]> wrote:
> Thanks for your replies,
> The date guide was really good, but as it is only a String comparison, I did 
> not want to over complicate the code.
> I have also tried the other two suggestions, and have still not been able to 
> get the match to work.
> I think that I might have to use an escape. I have tried the CGI.escape which 
> works quite well, and picks up the / character by converting it to a %2F, but 
> to use this method is overkill really as it is designed for all HTML 
> characters, so I am thinking that I just need a simple line of code to 
> replace all instances of / with %2F
>

Now that's crazy talk.  :)  Seriously, look at this code:


arr_date = "xxx01/01/07"

if arr_date =~ /01\/01\/07/
  puts "got a regex match"
  end
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Using Until

2007-04-03 Thread Nicola Kennedy
Hi,

Am v new to Watir/Ruby, so probably a simple question for someone.
I'm trying to put a loop in a script where it checks for a link on a page, if 
the link isn't there, it clicks on the next page button, looks for the link 
again, and the process repeats until it finds the link, and then clicks on it.

Can anyone help?

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


Re: [Wtr-general] Assert Dates?

2007-04-03 Thread Fletch
Thanks for your replies,
The date guide was really good, but as it is only a String comparison, I did 
not want to over complicate the code.
I have also tried the other two suggestions, and have still not been able to 
get the match to work.
I think that I might have to use an escape. I have tried the CGI.escape which 
works quite well, and picks up the / character by converting it to a %2F, but 
to use this method is overkill really as it is designed for all HTML 
characters, so I am thinking that I just need a simple line of code to replace 
all instances of / with %2F

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


Re: [Wtr-general] HTML element physical location on screen.

2007-04-03 Thread Vamsee Krishna M
Hey, Able to drag the code up to here.

def get_location_on_screen
assert_exists
rects = ole_object.getClientRects().item
x = rects.left
y = rects.top
width = rects.right - rects.left
height = rects.bottom - rects.top
puts "BEFORE #{x} #{y} #{width} #{height} "
#ClientToWindow call
@container.ie._invoke(301, [x, y], 
[WIN32OLE::VARIANT::VT_BYREF|WIN32OLE::VARIANT::VT_I4, 
WIN32OLE::VARIANT::VT_BYREF|WIN32OLE::VARIANT::VT_I4])
x = WIN32OLE::ARGV[0]
y = WIN32OLE::ARGV[1]
puts "AFTER  #{x} #{y} #{width} #{height} "
end 

GetClientRects method returns the valid values.
But when I make a call to ClientToWindow call its returning inaccurate values. 
If possbile somebody look into this code. BTW This function goes in to Element 
class.

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


Re: [Wtr-general] How to check for the presence of a frame in a page?

2007-04-03 Thread John Lolis
Take a look at this thread

http://forums.openqa.org/thread.jspa?threadID=7082&tstart=30

I give some ideas on how to approach a very similar problem.

The easy option to catch the specific exception and handle it from there.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Converts DOM Tree into XML file.

2007-04-03 Thread vijay
Hi people,

 I just want to know , how to convert The DOM Tree Structure into  a XML file 
format..?
And also can we save the DOM tree Structure from the IE's DOM Explorer.?

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


Re: [Wtr-general] HTML element physical location on screen.

2007-04-03 Thread Vamsee Krishna M
Thanks for these links helped me verymuch, although I have one problem, last 
method  ClientToWindow method doen't return anything insted it modifies the 
passed arguments with new  values, how to handle this situation in ruby ?
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] How to check for the presence of a frame in a page?

2007-04-03 Thread vijay
Hello people,

Our application has got several frames.  The controls need to be accesses 
through these frames like 
'$ie.frame('Detail').link(:text,'Disclosure').click'.  Before certain 
statements of this type, I want to check whether the particular frame is 
present in the current page or not.  How do I do that?  The '.exists?' method 
does not seem to work for a frame.  If we check a frame, which is not present 
in the current page,  through the '.exists?' method, Watir throws an exception 
saying "Unable to locate the given frame".

Thanks for your time,
Vijay
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] .Can we set the Watir's time_out_value in the script?

2007-04-03 Thread vijay
Thanks Jlolis for your reply.  It is exactly what I had wanted.

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