Re: [Wtr-general] finding text in a cell that contains a specified image?

2005-09-02 Thread Bret Pettichord

Check out the latest version of Watir from HEAD.

Now you can do:

  ie.table().table().table().cell().image().click

Each item searches inside the previous item. This now works with any 
element type.


In your case, you probably want something like:

  ie.table().table().table().cells.each {|c| c.text.strip if c.image(:src, 
xxx).exists?}


Bret

At 12:26 PM 9/1/2005, Warren Pollans wrote:

Thanks for the suggestion.  It works - but a little too well  :-)

It turns out that the page I'm checking has tables inside of tables
inside of tables ...

So this is returning the text in the highest level cell (including
those below it) that contains the image I specify although the actual
cell with the image is several layers down.  This is OK  before I was
matching ie.text to some expected text.

Now I'm curious.  Is there a way to keep track of where I am in the
hierarchy of tables so I know when I'm at the deepest level?  In your
example below, I guess I could save the text from each cell that
matches instead of returning one the first match - and then pick the
shortest string.  Is there a watir way?

On or about Fri, 19 Aug 2005 12:16:13 -0400
Shao Kang Tat [EMAIL PROTECTED] allegedly wrote:

 I'm doing something similar.  But I'm not dealing with images, rather
 links and texts, so I'd imagine the code would be similar to the one
 Im using and would work:


 ie.tables.each do|t|  # since you don't have ID's, look at every table
 for i in 1..t.row_count   # for every row in this table

 # for every column in this row, look at its contents
 t[i].each{|c| if c.image(:src, xxx).exists?  # if true, this
 is your cell
  return c.text.strip
 }
 end
 end







 On 8/19/05, Warren Pollans [EMAIL PROTECTED] wrote:
  Hello again,
 
  Could some please point me to a way of finding text in a cell that
  contains a specified image?  There are no ids available for the
  table, row or cell :-( - and there are several tables on the page.
  There is only one cell (at a time) that contains this particular
  image - the text in the cell is displaying status that I'm trying
  to capture.  This status msg can occur in one of four different
  tables - depending on which form on the page is submitted - the
  same image is used in all cases.
 
  I think I want to walk through the DOM looking for a td element
  that has img src=xxx - I imagine there's a simpler watir way  :-)
 
  Thanks,
 
  Warren
  ___
  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


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] new installers, autoit

2005-09-02 Thread Dave Burt

Bret:

Guess what? The one-click installer can be used as a command line installer.

watir-1.4.1.exe /S
...
I do like the idea of a separate script for uninstalling old versions of 
Watir.


You can't register the AutoIt DLL with the RubyGems, can you? That's another 
plus for the one-click installer.


Do you see AutoIt remaining as part of the Watir distribution, or being replaced 
by Watir popup-handling methods that just use COM?


Cheers,
Dave 


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


RE: [Wtr-general] Connecting to a second window

2005-09-02 Thread Mike Harris
Thanks for the help I received on this.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mike Harris
Sent: 31 August 2005 08:34
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] Connecting to a second window

Thanks for this. It is a pop up that is invoked using java script. I
have been looking for AutoIt in the Watir API, but can not find it. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: 31 August 2005 05:31
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] Connecting to a second window

If this is a modal popup, then you can't attach to it.

If you click on the main window, but the popup window stays on top, then
it is modal.

If it's small, you can try handling it with AutoIt.

Sorry folks.

Bret

At 09:08 PM 8/30/2005, [EMAIL PROTECTED] wrote:
I'm just curious. Is the second window already there upon running the 
program? if not maybe you could try putting wait(5) before the attach 
just to be  sure.

what's the exact error message?
and what's the exact title of the page when you view the source?

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] Behalf Of Mike Harris
Sent: Tuesday, August 30, 2005 7:19 PM
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] Connecting to a second window


Thanks.I tried that and still had the same problem. I have just noticed

that when I hover over the link with the mouse the path to the page for

the second window is displayed in the status bar, but this does not 
include the name of the file. I am wondering if this is the problem.

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Zeljko Filipin
Sent: 30 August 2005 10:57
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] Connecting to a second window

Try this

$ieAbout = Watir::IE.attach(:title, /About KALIDO MDM/)

instead of

$ieAbout = IE.attach(:title, /About KALIDO MDM/)

Zeljko

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Mike Harris
Sent: Tuesday, August 30, 2005 11:53 AM
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] Connecting to a second window

The last line put to the command console is attach failed. So I assume 
that it is the attach that has failed

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Zeljko Filipin
Sent: 30 August 2005 10:44
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] Connecting to a second window

In which line does your script fail (goto or attach)? What error 
message do you get?

Zeljko

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Mike Harris
Sent: Tuesday, August 30, 2005 11:39 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Connecting to a second window

I have just started to use Watir and am trying to connect to a new 
window using this code, but I fail to goto the link. Can you please 
give me some advice about why this may be failing. Thanks def 
test_03_ViewAbout
 puts Test 3...View About
 goToSignOnPage()
 login()
 begin
 statusMessage=Invoking About
 aboutlink=$ie.getLink(:text,About)
 statusMessage=goto link failed
 puts(goto link failed)
 $ie.goto(aboutlink.href)
 puts(attach failed)
 statusMessage=attach failed
 $ieAbout = IE.attach(:title, /About KALIDO
MDM/)
 statusMessage=assert failed
 assert($ieAbout.title==About KALIDO 
MDM,Failed to invoke About)
 statusMessage=close failed
 $ieAbout.close
 rescue
 errorstring =Failed while  + statusMessage
 failTest(3,errorstring)
 end
 end

Mike Harris

___
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 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

Re: [Wtr-general] Frames problem

2005-09-02 Thread Bret Pettichord

At 08:45 AM 9/2/2005, Boyt, Darrel wrote:

My thinking about frames doesn't seem to be in line with Watir's
implementation.  My thinking is that a frameset is basically a container
of frames that are separate web pages and that the methods I can access
with ie I should be able to access with ie.frame(:index, 1).  I'm
looking for things that tell me about the page like .url, .html, and the
show methods (.show_divs, .show_forms, .show_frames, .show_images,
.show_labels, .show_links, .show_spans, .show_tables).

Am I way off in left field on this???


No. I basically agree. We just haven't gotten there yet.

For now, try these:

  ie.frame(...).divs.show
  ie.frame(...).forms.show
  ie.frame(...).frames.show
  ie.frame(...).images.show
  ie.frame(...).labels.show
  ie.frame(...).links.show
  ie.frame(...).spans.show
  ...

These should work in 1.4.x and earlier, too.

I plan to fill out this list with ie.frame(...).elements.show, which will 
work like *.show_all_objects.


(In HEAD, these commands will work with any object. In 1.4.x, they only 
work with frames and forms and cells and ie and divs and spans and paragraphs.)


Bret


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] (no subject)

2005-09-02 Thread Boyt, Darrel
Thanks, Bret.  Works as advertised!

Darrel Boyt
Systems Analyst
Anteon Corporation
Montgomery, Alabama

At 11:30 AM 9/2/2005, Bret Pettichord wrote:
No. I basically agree. We just haven't gotten there yet.

For now, try these:

   ie.frame(...).divs.show
   ie.frame(...).forms.show
   ie.frame(...).frames.show
   ie.frame(...).images.show
   ie.frame(...).labels.show
   ie.frame(...).links.show
   ie.frame(...).spans.show
   ...

These should work in 1.4.x and earlier, too.

I plan to fill out this list with ie.frame(...).elements.show, which
will 
work like *.show_all_objects.

(In HEAD, these commands will work with any object. In 1.4.x, they only

work with frames and forms and cells and ie and divs and spans and
paragraphs.)

Bret


_
  Bret Pettichord
  www.pettichord.com

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