public static function match($actual, $expected) { self::$_description = ['description' => "to have an element found by the expected selector.", 'params' => ['actual' => $actual, 'expected' => "an element matching '{$expected}'"]]; if ($actual instanceof ElementNotFound) { self::$_description['params']['actual'] = (string) $actual; return false; } if (!$actual instanceof Element) { $repr = Str::toString($actual); throw new \Exception("Not a valid Mink DOM Element: {$repr}"); } return $actual->find(probable_expression_type($expected), $expected) !== null; }
/** * @param string $selector * @param Element $parent * @return NodeElement[] */ function elements($selector, Element $parent = null) { $parent = $parent ?: page(); return $parent->findAll(probable_expression_type($selector), $selector); }