Perform an xpath search on the contents of the internal browser. The search is relative to the root element (HTML tag normally) of the page.
$xpath: The xpath string to use in the search.
The return value of the xpath search. For details on the xpath string format and return values see the SimpleXML documentation, http://php.net/manual/function.simplexml-element-xpath.php.
protected function xpath($xpath, array $arguments = array()) {
if ($this
->parse()) {
$xpath = $this
->buildXPathQuery($xpath, $arguments);
$result = $this->elements
->xpath($xpath);
// Some combinations of PHP / libxml versions return an empty array
// instead of the documented FALSE. Forcefully convert any falsish values
// to an empty array to allow foreach(...) constructions.
return $result ? $result : array();
}
else {
return FALSE;
}
}