David, sometimes these people forget what it is like to be a newb, and 
give you specific information might be helpful *IF* you had a context in 
which to put it. From what you say, it appears you need some more 
general information first.

Watir can find elements on a page in a variety of ways. Among these are 
:name, :id, :index, and :text. Which is more appropriate depends on your 
specific use. As somebody mentioned, you should use :id when you can... 
but this presumes that the designer of the page used element ids 
properly. That is to say, in a well-formed page every element should 
have a unique id. Keep that in mind when designing your own pages. 
Sometimes you will encounter a page with elements that do not have an 
id, but do have a name. Then you are forced to use name instead, but 
name (according to the rules) is not required to be unique. If you have 
neither name or id, then you might have to fall back to using :index or 
even :text.

In this particular case the type of element you are trying to click is a 
link, and it has an id. So you probably want to do

    $ie.link(:id, 'sessionDialogCancel').click

However, I will caution you that it is usually not a good idea to use 
global variables like $ie.  In the vast majority of cases, you will want 
to use an instance variable instead, which uses the @ sign. So rather 
than $ie you would have @ie.

Lonny Eachus
==========
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to