Re: [wtr-general] Re: click on html element

2010-08-24 Thread Željko Filipin
On Wed, Aug 18, 2010 at 1:23 PM, TCBlues  wrote:
> So it is not possible to access using something like
> brow.element(:id,"xxx") or brow.object(:id,"xxx") or something
> similar.

It is:

http://wiki.openqa.org/display/WTR/XPath

Željko
--
watir.com - community manager
watirpodcast.com - host
testingpodcast.com - audio podcasts on software testing. all of them
vidipodkast.com - pričamo o hardveru, softveru i časopisu Vidi

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: click on html element

2010-08-18 Thread Chuck van der Linden
With the exception of using ID as the identifier, You can't do a
generic element, you need to invoke a method that is specific to the
element type, but if you know what kind of tag, then you know what
type of element (since tags define the elements)

You can access most elements by multiple means   Excepting the case of
attaching to a new browser window, ID, Name, Index, are nearly
universal, class works for everything but frames,  and 'text' works
for a majority of elements, and looks for the element according to the
text within it.

Using the contained text is often a great way to select a specific
div, link, cell, or even a row (sometimes via a reg-ex match on some
unique bit of text that will be found on that row).

'Clickable' text is almost always contained in some kind of other
element, it's really rare to see it 'naked' at the body level, just
purely due to the needs of isolating the 'clickability' to that text
only, instead of the entire body.  So generally if you know the
element, you can use .click on it.  If that doesn't work, have a
closer look at the HTML and try to find what javascript event is being
watched for, and fire that event at the element

Now, (unless it was changed recently) there is a bit of a loophole
with respect to identifying things by ID.  (and I'd recommend some
experimentation to validate this works for you, it's not a tactic I
use).  Since ID's are supposed to be unique within the document, it
appears that if you identify an element by ID, watir doesn't 'care'
about matching the element type, it just looks for the first
occurrence of that one specific ID, and returns whatever it finds. It
doesn't look to see if there's more than one (there never should be as
it's supposed to be unique) nor does it work well to use ID combined
with some other attribute (which in theory, you should never need to
do).  I've run into this by accident, where I specified the id wrong,
and despite asking for element type x, it returned element y which a
matching ID.

I don't know if that's intentional, or just a byproduct of the
assumption that the html will be valid, ID's will be unique, etc.
I've always considered it an 'undocumented feature' and hesitated to
use it in any of my scripts.

Sample html would help, or at the very least, what kind of tag

On Aug 18, 4:23 am, TCBlues  wrote:
> So it is not possible to access using something like
> brow.element(:id,"xxx") or brow.object(:id,"xxx") or something
> similar.
> The only way is to know before hand what kind of tag we'll be
> accessing.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: click on html element

2010-08-18 Thread TCBlues
So it is not possible to access using something like
brow.element(:id,"xxx") or brow.object(:id,"xxx") or something
similar.
The only way is to know before hand what kind of tag we'll be
accessing.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: click on html element

2010-08-17 Thread orde
This is a matrix of supported elements and respective attributes:
http://wiki.openqa.org/display/WTR/HTML+Elements+Supported+by+Watir.
It includes cell, table and div (i.e. ,  and ).

If you want to extend watir, check out this link:
http://wiki.openqa.org/display/WTR/FAQ#FAQ-HowdoIaccessAnyTaginHTML%28DOM%29withWatir%3F

orde

On Aug 17, 4:09 am, TCBlues  wrote:
> is it possible to click any element using an id... something like
> ie.element(:id,"myid").click
>
> On 17 ago, 12:45, TCBlues  wrote:
>
>
>
> > the html I need to access has no ids or names:
> > ... AB
> > and also sometimes I need to click on words without any tag:
> > 
> > The text I want to click
> > 
> > On 17 ago, 12:27, TCBlues  wrote:
>
> > > Hi, I need to click on an html element using watir and firewatir, for
> > > example:
> > > A
> > > Since this is not a button or a link... how can I do it?

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: click on html element

2010-08-17 Thread TCBlues
is it possible to click any element using an id... something like
ie.element(:id,"myid").click

On 17 ago, 12:45, TCBlues  wrote:
> the html I need to access has no ids or names:
> ... AB
> and also sometimes I need to click on words without any tag:
> 
> The text I want to click
> 
> On 17 ago, 12:27, TCBlues  wrote:
>
>
>
> > Hi, I need to click on an html element using watir and firewatir, for
> > example:
> > A
> > Since this is not a button or a link... how can I do it?

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: click on html element

2010-08-17 Thread TCBlues
the html I need to access has no ids or names:
... AB
and also sometimes I need to click on words without any tag:

The text I want to click

On 17 ago, 12:27, TCBlues  wrote:
> Hi, I need to click on an html element using watir and firewatir, for
> example:
> A
> Since this is not a button or a link... how can I do it?

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com