Hi santhosh,
Is all the list items have the same number of Div tags or not? If so
then the solution is here.
First you need to get the number of list items through
getXpathCount(String Xpath) method in selenium by passing the Xpath as
parameter. See below code
String Xpath = "//div[@class='discovered_list_wrapped']//ul/
li"
Number count = Selenium.getXpathCount(Xpath);
int listCount =
count.intValue();                                           ---->
This will give the number of list items under the UL tag. (Here i
considered there is only one UL tag)
for ( int i = 1 ; i <=listCount; i++)
{
Here is your code to click every image in that list. If you want to
check number of div tags here also use the same above method.
}
On Jun 28, 11:47 pm, santosh h s <
santosh.s...@gmail.com> wrote:
> Could some one help me solving this issue. its very urgent
>
 > On Tue, Jun 28, 2011 at 11:54 PM, santosh h s <
santosh.s...@gmail.com>wrote:
>
>
>
> > Hi,
>
> > below is my HTML code please refer the attached screen shot for the same
> > HTML source code.
>
> > Here i want click on the list based on the text it has suppose the very
> > first list has text San HD     and i want click on this list based on text
> > it has .
>
> > please let me know how to achive this.
>
> > each list has different such names, so i want click based those names.
> > please provide sample code in Java.
>
> > <div id="discovered_list_wrapper" style="left: 114px; width: 734px;">
> > <ul id="discovered_sling_boxes_list" style="left: 0px; width: 13780px;">
> > <li class="sling_box_bg_off">
> > <div class="sling_box_bottom">
> > <li class="sling_box_bg_off">
> > <li class="sling_box_bg_off">
> > <li class="sling_box_bg_off off">
> > <li class="sling_box_bg_off off">
> >  </ul>
> > </div>
>
> > /santosh
>
> > On Tue, Jun 28, 2011 at 7:44 PM, Mark Collin <
m...@ardescosolutions.com>wrote:
>
> >> You can get a list of all div elements using the following:****
>
> >> ** **
>
> >> List<WebElement> bar = driver.findElements(By.xpath("//div"));****
>
> >> ** **
>
> >> You can then interact with each element in the list e.g.****
>
> >> ** **
>
> >> for(WebElement current : bar){****
>
> >>     System.out.println("Text for current element is '" + current.getText()
> >> + "'");****
>
> >> }****
>
> >> ** **
>
> >> *From:* 
seleniu...@googlegroups.com [mailto:
> >> 
seleniu...@googlegroups.com] *On Behalf Of *santosh h s
> >> *Sent:* 28 June 2011 15:05
> >> *To:* 
seleniu...@googlegroups.com
> >> *Subject:* [selenium-users] how to get Xpath of all the Div elements in
> >> Selenium.****
>
> >> ** **
>
> >> How to get how to get  Xpath of all the Div elements in Selenium.****
>
> >> Suppose a div has 10 elements how can i get xpath of all the elements
> >> using selenium.
>
> >> --
> >> Regards,
> >> Santosh****
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Selenium Users" group.
> >> To post to this group, send email to 
seleniu...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> 
selenium-user...@googlegroups.com.
> >> For more options, visit this group at
> >>
http://groups.google.com/group/selenium-users?hl=en.****
>
> >> -- This message contains confidential information and is intended only for
> >> the individual named. If you are not the named addressee you should not
> >> disseminate, distribute or copy this e-mail. Please notify the sender
> >> immediately by e-mail if you have received this e-mail by mistake and delete
> >> this e-mail from your system. If you are not the intended recipient you are
> >> notified that disclosing, copying, distributing or taking any action in
> >> reliance on the contents of this information is strictly prohibited. If you
> >> have received this email in error please notify
> >> 
postmas...@ardescosolutions.com