function Execute::serializeArguments
Serialize script arguments (containing web elements and/or shadow roots)
Parameters
array $arguments:
Return value
array
See also
https://w3c.github.io/webdriver/#executing-script
4 calls to Execute::serializeArguments()
- Execute::async in vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Execute.php - Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. (asynchronous)
- Execute::sync in vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Execute.php - Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. (synchronous)
- LegacyExecute::async in vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ LegacyExecute.php - Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. (asynchronous)
- LegacyExecute::sync in vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ LegacyExecute.php - Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. (synchronous)
File
-
vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Execute.php, line 70
Class
- Execute
- WebDriver\Execute class
Namespace
WebDriverCode
protected function serializeArguments(array $arguments) {
foreach ($arguments as $key => $value) {
if ($value instanceof LegacyElement) {
$arguments[$key] = [
LegacyElement::LEGACY_ELEMENT_ID => $value->getID(),
];
}
elseif ($value instanceof Element) {
$arguments[$key] = [
Element::WEB_ELEMENT_ID => $value->getID(),
];
}
elseif ($value instanceof Shadow) {
$arguments[$key] = [
Shadow::SHADOW_ROOT_ID => $value->getID(),
];
}
elseif (is_array($value)) {
$arguments[$key] = $this->serializeArguments($value);
}
}
return $arguments;
}