ruby - WatirWebdriver using Xpath to find children of a given node -


i trying 2 stage xpath selection watirwebdriver, first find elements within container , find specific info each element:

# select elements of interest browser.divs(xpath: '/html/body/ul/li[@class="thing"]').each |pannel|   # select info each element   panel.element(xpath: '//h1[@class="thing_title"]/a') end 

the problem second xpath select not search children of given node. searches entire page , selects first match - same info of first match every time. found 1 solution give complete path so:

# select info each element panel.element(xpath: 'div/div[2]/div[1]/div/h1/a') 

but path not same every time, breaks things.

is there way search children of given node only, without specifying complete path?

the problem inner xpath says search h1 element anywhere in document. search within context of current node, need tell xpath starting .:

panel.element(xpath: './/h1[@class="thing_title"]/a') 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -