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

getElementsByAltText() public method

public getElementsByAltText ( string $text, string $tags = '*' ) : array<\DataSift\WebDriver\WebDriverElement>
$text string
$tags string
return array<\DataSift\WebDriver\WebDriverElement>
    public function getElementsByAltText($text, $tags = '*')
    {
        // what are we doing?
        $tag = $this->convertTagsToString($tags);
        $log = usingLog()->startAction("get '{$tag}' elements with alt text '{$text}'");
        // 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 . '[@alt = "' . $text . '"]';
        }
        // get the possibly matching elements
        $elements = $this->getElementsByXpath($xpathList);
        // log the result
        $log->endAction(count($elements) . " element(s) found");
        // return the elements
        return $elements;
    }