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

getElementsByClass() public method

public getElementsByClass ( string $class, string $tags = '*' ) : array<\DataSift\WebDriver\WebDriverElement>
$class string
$tags string
return array<\DataSift\WebDriver\WebDriverElement>
    public function getElementsByClass($class, $tags = '*')
    {
        // what are we doing?
        $tag = $this->convertTagsToString($tags);
        $log = usingLog()->startAction("get '{$tag}' elements with CSS class '{$class}'");
        // prepare the list of tags
        if (is_string($tags)) {
            $tags = array($tags);
        }
        // build up the xpath to use
        $xpathList = array();
        foreach ($tags as $tag) {
            $xpathList[] = 'descendant::' . $tag . '[contains(concat(" ", normalize-space(@class), " "), " ' . $class . ' ")]';
        }
        // find the matches
        $elements = $this->getElementsByXpath($xpathList);
        // log the result
        $log->endAction(count($elements) . " element(s) found");
        // return the elements
        return $elements;
    }