function Selenium2Driver::charToOptions
Creates some options for key events
Parameters
string|int $char the character or code:
KeyModifier::*|null $modifier:
Return value
string a json encoded options array for Syn
Throws
3 calls to Selenium2Driver::charToOptions()
- Selenium2Driver::keyDown in vendor/
lullabot/ mink-selenium2-driver/ src/ Selenium2Driver.php - Pressed down specific keyboard key.
- Selenium2Driver::keyPress in vendor/
lullabot/ mink-selenium2-driver/ src/ Selenium2Driver.php - Presses specific keyboard key.
- Selenium2Driver::keyUp in vendor/
lullabot/ mink-selenium2-driver/ src/ Selenium2Driver.php - Pressed up specific keyboard key.
File
-
vendor/
lullabot/ mink-selenium2-driver/ src/ Selenium2Driver.php, line 270
Class
- Selenium2Driver
- Selenium2 driver.
Namespace
Behat\Mink\DriverCode
protected static function charToOptions($char, ?string $modifier = null) {
if (is_int($char)) {
$charCode = $char;
$char = chr($charCode);
}
else {
$charCode = ord($char);
}
$options = array(
'key' => $char,
'which' => $charCode,
'charCode' => $charCode,
'keyCode' => $charCode,
);
if ($modifier) {
$options[$modifier . 'Key'] = true;
}
$json = json_encode($options);
if ($json === false) {
throw new DriverException('Failed to encode options: ' . json_last_error_msg());
}
return $json;
}