public function BrowserBase::command in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/jcalderonzumba/gastonjs/src/Browser/BrowserBase.php \Zumba\GastonJS\Browser\BrowserBase::command()
Sends a command to the browser
Return value
mixed
Throws
\Exception
8 calls to BrowserBase::command()
- Browser::drag in vendor/
jcalderonzumba/ gastonjs/ src/ Browser/ Browser.php - Drag an element to a another in a given page
- Browser::isDisabled in vendor/
jcalderonzumba/ gastonjs/ src/ Browser/ Browser.php - Browser::isVisible in vendor/
jcalderonzumba/ gastonjs/ src/ Browser/ Browser.php - Tells whether an element on a page is visible or not
- Browser::select in vendor/
jcalderonzumba/ gastonjs/ src/ Browser/ Browser.php - Selects a value in the given element and page
- Browser::sendKeys in vendor/
jcalderonzumba/ gastonjs/ src/ Browser/ Browser.php - TODO: not sure what this does, needs to do normalizeKeys
File
- vendor/
jcalderonzumba/ gastonjs/ src/ Browser/ BrowserBase.php, line 81
Class
- BrowserBase
- Class BrowserBase @package Zumba\GastonJS\Browser
Namespace
Zumba\GastonJS\BrowserCode
public function command() {
try {
$args = func_get_args();
$commandName = $args[0];
array_shift($args);
$messageToSend = json_encode(array(
'name' => $commandName,
'args' => $args,
));
/** @var $commandResponse \GuzzleHttp\Psr7\Response|\GuzzleHttp\Message\Response */
$commandResponse = $this
->getApiClient()
->post("/api", array(
"body" => $messageToSend,
));
$jsonResponse = json_decode($commandResponse
->getBody(), TRUE);
} catch (ServerException $e) {
$jsonResponse = json_decode($e
->getResponse()
->getBody()
->getContents(), true);
} catch (ConnectException $e) {
throw new DeadClient($e
->getMessage(), $e
->getCode(), $e);
} catch (\Exception $e) {
throw $e;
}
if (isset($jsonResponse['error'])) {
throw $this
->getErrorClass($jsonResponse);
}
return $jsonResponse['response'];
}