History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WTR-191
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Angrez
Reporter: Christian Fraenkel
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Watir

Filling Collection objects using XPATH

Created: 13/Dec/07 06:49 AM   Updated: 06/Apr/08 11:32 AM
Component/s: Xpath Support
Affects Version/s: Future
Fix Version/s: Future

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
Currently Collection objects iterate over all Elements of their type in the whole document.
It would be nice if it was possible to construct collections that restrict their content to Elements which match a supplied XPath.

for example
ie.links("div[id='test']/a")

should only return the a tags that are directly below a div tag.

 All   Comments   Work Log   Change History      Sort Order:
Bret Pettichord - 06/Jan/08 12:13 PM
Could you please explain why

ie.div(:id, 'test').links

would not work for the required functionality?

Christian Fraenkel - 06/Jan/08 12:31 PM
that probably works... lets pick another example then :)
take an xpath like "a[@foo='bar']"
which in an xpath evaluator returns all "a" nodes that have foo set to bar in the whole document, or relative to your current node.

Angrez - 07/Jan/08 01:17 AM
Currently you can use "elements_by_xpath" for getting all the elements that matches current xpath. The only problem is that it will return array of underlying objects not Watir objects.

Christian Fraenkel - 07/Jan/08 10:23 AM
I'm aware of that way, and the problem of not getting Watir objects. Its for this reason that I opened this request - I belive that watir would benefit from such functionality.