I think you have to study the Watir guide.

Solution 1:
$ie.divs.collect {|div|
if div.class_name == "mydata"
   puts div.text
end
}
Solution 2:
$ie.lis.collect {|li|
puts li.div(:index, 1).text
}


Thanks.
Wesley Chen.
For life, the easier, the better.


On Mon, Nov 9, 2009 at 6:32 PM, Soori <[email protected]> wrote:

>
> Thanks Frédéric de Villamil  for the quick response.
>
> I would also like to capture the text on the div as shown below.
>
> the code is something like this,
>
> <div class="test_container" id="mytest-data">
> <li>
> <div class="mydata" encoded="iudasfhakASDa=" onselectstart="return
> false;">TEST DATA1</div>
> <div class="my_options" id="my_options_1">
> </div>
> <div class="clear_float"></div>
> </li>
> <li>
> <div class="mydata" encoded="dsfsfsfs98fdfdd=" onselectstart="return
> false;">TESTDATA2</div>
> <div class="my_options" id="my_options_1">
> </div>
> <div class="clear_float"></div>
> </li>
> <li>
> <div class="mydata" encoded="sdfsfsfs980sdfss=" onselectstart="return
> false;">TESTDATA3</div>
> <div class="my_options" id="my_options_1">
> </div>
> <div class="clear_float"></div>
> </li>
>
> I would like to capture the "TESTDATA1", "TESTDATA2", etc from the div
> through the script.
>
> Your help would be appreciated.
>
> Thanks again
>
> /Soori
>
>
> On Nov 9, 2:05 pm, de Villamil Frédéric <[email protected]> wrote:
> > Le 9 nov. 2009 à 10:01, Soori a écrit :
> >
> >
> >
> > > Hi All,
> >
> > > I would like to capture all the links under a particular div class.
> >
> > > could you please help me in this front.?
> >
> > > Thanks
> > > Soori
> >
> > Hello soori,
> >
> > You should use the links method as a sub element of your div (read the
> > doc Luke). Should be something like this:
> >
> > @browser.div(:class /yourclass/).links.each do |link|
> >     some code here...
> > end
> >
> > Regards
> >
> > --
> > Frédéric de Villamil
> > "What's mine is mine. What's yours is still unsetteled" – Go player
> > proverb
> > [email protected]                        tel: +33 (0)6 62 19 1337
> http://t37.net                                               Typo :
> http://typosphere.org
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to