DataSift\Storyplayer\BrowserLib\DomElementSearch::getElementsByLabelIdOrName PHP Method

getElementsByLabelIdOrName() public method

public getElementsByLabelIdOrName ( string $searchTerm, string $tags = '*' ) : array<\DataSift\WebDriver\WebDriverElement>
$searchTerm string
$tags string
return array<\DataSift\WebDriver\WebDriverElement>
    public function getElementsByLabelIdOrName($searchTerm, $tags = '*')
    {
        // what are we doing?
        $tag = $this->convertTagsToString($tags);
        $log = usingLog()->startAction("get '{$tag}' with label, id or name '{$searchTerm}'");
        // our return value
        $retval = [];
        // can we find this puppy by its label?
        try {
            $retval = array_merge($retval, $this->getElementsByLabel($searchTerm));
        } catch (Exception $e) {
            // do nothing
        }
        // are there any with the ID?
        try {
            $retval = array_merge($this->getElementsById($searchTerm, $tags));
        } catch (Exception $e) {
            // do nothing
        }
        // and what about finding it by its text?
        $retval = array_merge($retval, $this->getElementsByName($searchTerm, $tags));
        // log the result
        $log->endAction(count($retval) . " element(s) found");
        // return the elements
        return $retval;
    }