Skip to content

Working with element hierarchy

jubishop edited this page Dec 20, 2011 · 2 revisions

Sibling relationship

<div id='base_element'></div>
<div class="descr">test is passed</div>

$txt = $session->element('xpath', "//div[@id='base_element']/following-sibling::div[@class='descr']")->text();

Parent-child relationship

<div id='base_element'>
  <div class="descr">test is passed</div>
</div>

$txt = $session->element('id', 'base_element')->element('xpath', 'div[@class="descr"]')->text();
Clone this wiki locally