--
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.
Use the selenium 2 implementation:
List<WebElement> itemAddressList = driver.findElements(By.xpath("//foo"));
This will give you a list of webElements that you can iterate through as required.
Regards
Mark
--
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 won’t work unless your xpath is counting the children of a specific parent.
--
Again you are assuming that the OP is looking for elements that are all the child of the same parent.
Solutions like this would not work in the following case:
<html>
<head>
</head>
<body>
<div>
<ul class=”foo”>
<li>stuff</li>
</ul>
</div>
<ul class=”foo”>
<li>other stuff</li>
</ul>
</div>
<div>
<ul class=”foo”>
<li>not stuff</li>
</ul>
</div>
</body>
</html>
An xpath count of //ul[@class=”foo”] on the above would return a count of 3, however every element above is an //ul[@class=”foo”][1] (i.e. the first child of a parent) so your iteration solution below cannot and will not work.
From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of Mohammed Sikander
Sent: 18 May 2011 12:32
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] Get arrays of values from a xpath
Hi,
In the example below each <li> element is the first child of its parent <ul>
element, if you look for the second child (// ul[@class=”foo”]/li[2]) you
won't find anything because there are no second children under an <ul>
element.
You are actually proving my point :)
If you have received this email in error please notify postm...@ardescosolutions.com
If you have received this email in error please notify postm...@ardescosolutions.com