Hi,

Its working fine now, i used  frames.
Thanks for everyone's help.

Thanks

On Oct 17, 10:15 am, Chuck van der Linden <[email protected]> wrote:
> On Oct 15, 12:19 am, ash <[email protected]> wrote:
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > Below is my portion of html code.
>
> > I want to click TestSettings tab.
>
> > <div id="testnavigation" style="float:left;left:33px">
> > <ul id="testtablist">
> > <li id="test_tab_settings" class="test-current">
> > <a title="testSettings" onclick="Pages.go('testdisplaySiteSettings',
> > 1); return false;" href="#">
> > <span id="testspan">TestSettings</span>
> > </a>
> > </li>
> > </ul>
> > </div>
>
> > I tired all 3 below option.But nothing works.
>
> > ie.link(:id, 'test_tab_settings').click
>
> This would not work because there is no link element with this ID, the
> element with this ID is a 'li' tag which is a "List Item".  I expect
> this got an error of the sort relating to being unable to find the
> item, or if it did not get an error, it did not actually 'click the
> link' since the list item has no event action defined.
>
> > ie.span(:text, 'TestSettings').click
>
> This should have worked, since there is a span element, although I
> don't expect anything to have happened because again the span is not
> the element which is looking for the 'onclick' to occur.  However
> given the one error you showed (it might be more helpful to know the
> error associated with each of the things you tried) it leads me to
> wonder if the elements there are inside a frame or something that
> would prevent them being found and require you to address them
> starting with the frame object (see RJ's answer)
>
> > ie.div(:id, 'testnavigation').click
>
>  While this div exists, it appears to be an outer container for the
> entire tab list, so I would not expect clicking it to do anything, and
> if you got an error trying to do this then there is some otther
> problem exists (again, frames might be my first guess)
>
>  The structure of your page appears to be (using periods in a futile
> attempt to force intented formatting)
>
>  Unordered List (UL tag) which is the list of tabs
>  . List item (LI tag) which appears to be the tag,
>  . . Link (A tag) which is wired to respond to clicks
>  . . .Span (Span tag) which contains the text for the tab
>
> The List Item has an ID, which should be uique and thus makes it easy
> to identify.  The Link has a title which may or may not be unique, it
> also ends up having text since there is text in the span within the
> link.  So two tactics you could employ would be to identify the list
> item, and then the first link within it, and click that, the other
> would be to click the link via the text contained within the link.
>
> Using watir 2.x or Watir-webdriver, either of the following should
> work unless these things are inside a frame
>
>  browser.li(:id, "test_tab_settings").link.click
>  . or
>  browser.link(:text, "TestSettings").click
>
> If those give errors saying the element can not be located then it's
> time to check for frames, see thishttp://wiki.openqa.org/display/WTR/Frames
> for more info on how to do that.
> ----
> As a word of advice, since you mistook a list item for a link, your
> knowledge of HTML might be a little weak, and I can tell you from
> experience that's a place where you need a pretty good skill base.  It
> is especially important for someone doing webtesting, and in
> particular web based automation to have a good understanding of basic
> HTML and HTTP as well, so that might be an area you will want to seek
> to improve

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

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to