Skip to content

Working with element hierarchy

ildar-aim edited this page Dec 20, 2011 · 2 revisions

The same level

<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