Re: [Wtr-general] Unable to click on links with the same text

2007-07-02 Thread Angrez Singh

Try this:

ie.link(:href, bcd).click

- Angrez

On 7/2/07, Lavanya Lakshman [EMAIL PROTECTED] wrote:


Following is my sample script :
html
head
titleTitle of page/title
/head
body
This is my first homepage. bThis text is bold/b
a href=urlText to be displayed/a
a href=bcdText to be displayed/a
/body
/html


Now as per Watir syntax, I am trying to click on link 2:
# This allows test script to use Watir tool
require 'watir'
require 'watir/watir_simple.rb'
include Watir
include Test::Unit::Assertions
ie = Watir::IE.attach(:title, Title of page)
ie.link(:text = 'Text to be displayed', :index  = 2).click


Upon execution, I am getting the following error:
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:963:in `getLink': {:index=2,
:text=Te
xt to be displayed} is an unknown way of finding a link (  )
(Watir::Exception::MissingWayOfFindingObjectException)
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2830:in `initialize'
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:570:in `new'
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:570:in `link'
from E:/PROVIS/sample.rb:10
___
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] Unable to click on links with the same text

2007-07-02 Thread Lavanya Lakshman
Following is my sample script :
html
head
titleTitle of page/title
/head
body
This is my first homepage. bThis text is bold/b
a href=urlText to be displayed/a
a href=bcdText to be displayed/a
/body
/html 


Now as per Watir syntax, I am trying to click on link 2: 
# This allows test script to use Watir tool
require 'watir'
require 'watir/watir_simple.rb'
include Watir
include Test::Unit::Assertions
ie = Watir::IE.attach(:title, Title of page)
ie.link(:text = 'Text to be displayed', :index  = 2).click


Upon execution, I am getting the following error:
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:963:in `getLink': {:index=2, :text=Te
xt to be displayed} is an unknown way of finding a link (  ) 
(Watir::Exception::MissingWayOfFindingObjectException)
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2830:in `initialize'
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:570:in `new'
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:570:in `link'
from E:/PROVIS/sample.rb:10
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] CAN BE CLICK LINK ASSOCIATED WITH AN IMAGE

2007-07-02 Thread Jason
  ie.text_field(:after?, ie.label(:for, confirmPassword)).flash
 What's :for? It's not part of Watir. Have you tried by :name and/or :id? 

Fair point.  

I originally tried it from this page: 
http://wiki.openqa.org/display/WTR/Methods+supported+by+Element where it states:

 label  label tags (including for attribute)

Simply because it was the only available attribute for this field.  No ID, no 
NAME, no CLASS.  Nothing.

And it appeared to work, on it's own:

   ie.label(:for, confirmPassword).flash

certainly finds the label with this attribute.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] CAN BE CLICK LINK ASSOCIATED WITH AN IMAGE

2007-07-02 Thread Charley Baker

Well, you learn something new every day. I haven't worked with labels, :for
is a supported how for labels. Teach me to answer a question without trying
it out. :)   The :after? tag doesn't appear to apply to input elements,
buttons, text_fields, frames. Add a JIRA ticket if you'd like to see it
fixed and ideally also a failing unit test.

-Charley

On 7/2/07, Jason [EMAIL PROTECTED] wrote:


  ie.text_field(:after?, ie.label(:for, confirmPassword)).flash
 What's :for? It's not part of Watir. Have you tried by :name and/or :id?

Fair point.

I originally tried it from this page:
http://wiki.openqa.org/display/WTR/Methods+supported+by+Element where it
states:

 label  label tags (including for attribute)

Simply because it was the only available attribute for this field.  No ID,
no NAME, no CLASS.  Nothing.

And it appeared to work, on it's own:

   ie.label(:for, confirmPassword).flash

certainly finds the label with this attribute.
___
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] Problem with attach using :title

2007-07-02 Thread marekj

a quick question about attaching to the session of IE.
I am currently relying on attaching to one window on the desktop but I want
to move towards running -b(ackground) option of Watir and running multiple
IE windows. The best way I think I can do this is to maintain a handle to
each IE instance. On my setup script that starts IE instance I can write out
:hwnd and mainaint my test session based on that so each script talk to the
correct window.

Before I jump into doing this I want to find out if it's possible to do in
with -b option and if I am on the right track.

so for example
I will do this in my startup
$ie = Watir.start()
$ie_hwnd = $ie.hwnd()

then in my test cases I attach to the instance
$ie = Watir::IE.attach(:hwnd, $ie_hwnd)

Then I can run another script file containing testCases with the same code.

So this will create another thread of execution and each thread will have
$ie attached to different instance of IE in memory.
Am I on the right track?
Your ideas are much appreciated.
Thanks
marekj





On 6/30/07, Bret Pettichord [EMAIL PROTECTED] wrote:


jim_matt wrote:
 I wanted to share something I discovered.  I had reported earlier that
 I sometimes I had problems attaching a browser using :title.  The
 problem turns out to be that title is part of the HTML.  The
 confusion comes because if the HTML does not have a title,  IE
 displays the URL in the title bar of the browser.  This makes it look
 like you should be able to attach the IE browser using :title, but
 the attach will fail with an error like:

 Watir::Exception::NoMatchingWindowFoundException: Unable to locate a
 window with title of (?i-mx:whatever you used to match)

 This is worth a note in the documentation for matching on :title
 because it certainly looks like it should work.

This report is correct (we've discussed this offline). Both the
IE.attach and the ie.title method are consistent in this regard -- both
consider the title to be the HTML title of the page, which is not
necessarily what appears in the title bar.

Bret
___
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] Problem with attach using :title

2007-07-02 Thread Bret Pettichord
marekj wrote:
 a quick question about attaching to the session of IE.
 I am currently relying on attaching to one window on the desktop but I 
 want to move towards running -b(ackground) option of Watir and running 
 multiple IE windows. The best way I think I can do this is to maintain 
 a handle to each IE instance. On my setup script that starts IE 
 instance I can write out :hwnd and mainaint my test session based on 
 that so each script talk to the correct window.

 Before I jump into doing this I want to find out if it's possible to 
 do in with -b option and if I am on the right track.

 so for example
 I will do this in my startup
 $ie = Watir.start()
 $ie_hwnd = $ie.hwnd()

 then in my test cases I attach to the instance
 $ie = Watir::IE.attach(:hwnd, $ie_hwnd)

 Then I can run another script file containing testCases with the same 
 code.

 So this will create another thread of execution and each thread will 
 have $ie attached to different instance of IE in memory.
 Am I on the right track?
 Your ideas are much appreciated.
 Thanks
 marekj
I don't understand why you don't just use the $ie value directly.

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


Re: [Wtr-general] Problem with attach using :title

2007-07-02 Thread marekj

On 7/2/07, Bret Pettichord [EMAIL PROTECTED] wrote:


marekj wrote:
 a quick question about attaching to the session of IE.
 I am currently relying on attaching to one window on the desktop but I
 want to move towards running -b(ackground) option of Watir and running
 multiple IE windows. The best way I think I can do this is to maintain
 a handle to each IE instance. On my setup script that starts IE
 instance I can write out :hwnd and mainaint my test session based on
 that so each script talk to the correct window.




I don't understand why you don't just use the $ie value directly.
Bret


hmmm... I was thinking that if I have 3 scripts running at the same time
with -b switch they would get confused at which window to talk to.

I set my $ie in a generic way in setup script which is than later required
by each test.
like so...
$ie = Watir::IE.attach(:title, //)

so it attaches to IE that I am working with (and there is always one) 
but now I want to run more instances of IE at once (I hope that's possible)
I thought I need to clearly specify, perhaps by unique handle which one to
attach to.
I am sure I am missing something... or making false assumptions about
execution.
gonna dig more...
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general