function Container::element
Find element: /session/:sessionId/element (POST) Find child element: /session/:sessionId/element/:id/element (POST) Search for element on page, starting from the document root.
Parameters
string $using the locator strategy to use:
string $value the search target:
Return value
Throws
\WebDriver\Exception if element not found, or invalid XPath
File
-
vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Container.php, line 52
Class
- Container
- Abstract WebDriver\Container class
Namespace
WebDriverCode
public function element($using = null, $value = null) {
$locatorJson = $this->parseArgs('element', func_get_args());
try {
$result = $this->curl('POST', '/element', $locatorJson);
} catch (WebDriverException\NoSuchElement $e) {
throw WebDriverException::factory(WebDriverException::NO_SUCH_ELEMENT, sprintf("Element not found with %s, %s\n\n%s", $locatorJson['using'], $locatorJson['value'], $e->getMessage()), $e);
}
$element = $this->makeElement($result['value']);
if ($element === null) {
throw WebDriverException::factory(WebDriverException::NO_SUCH_ELEMENT, sprintf("Element not found with %s, %s\n", $locatorJson['using'], $locatorJson['value']));
}
return $element;
}