Page 1 of 1

How can I get child nodes

Posted: Fri Nov 22, 2019 10:42 am
by martin
Tell me how to get all the data of the child nodes in the Human Emulator Studio.
There is a site with such html code

Code: Select all

 
<div class="rc">
               <div class="r">
                  <a href="url" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=/&amp;ved=2ahUKEwjGkfTS__vlAhUn_SoKHYr_BjoQFjAAegQIAxAB">
                     <h3 class="LC20lb"><span class="S3Uucc">...</span></h3>
                     <br>
                     <div class="TbwUpd"><cite class="iUh30"></cite></div>
                  </a>
.... here next  <div class="r"> 
.... etc

I need to loop around all div class="r" and get address of the first link

The position of the elements can change.

Please help.

Re: How can I get child nodes

Posted: Fri Nov 22, 2019 11:22 am
by support
Hi.

php example:

Code: Select all

// get all div with class=r
$lis = $div->get_all_by_attribute("class", "r", true);

foreach($lis->elements as $v) 
{
   // get child element with attribute ping contains /url?
   $link = $v->get_child_by_attribute ("ping", "/url?", false);

   // here you can get any child element attribute 
   echo $link->get_href()."<br>";
}

Re: How can I get child nodes

Posted: Fri Nov 22, 2019 12:22 pm
by martin
Thanks!