findElement($xpath, 1); $key = $this->normalizeCharForKeyEvent($char); $modifier = $this->keyEventModifierControl($modifier); return $this->browser->keyEvent($element["page_id"], $element["ids"][0], "keydown", $key, $modifier); } /** * @param string $xpath * @param string $char * @param string $modifier * @throws DriverException */ public function keyPress($xpath, $char, $modifier = null) { $element = $this->findElement($xpath, 1); $key = $this->normalizeCharForKeyEvent($char); $modifier = $this->keyEventModifierControl($modifier); return $this->browser->keyEvent($element["page_id"], $element["ids"][0], "keypress", $key, $modifier); } /** * Pressed up specific keyboard key. * * @param string $xpath * @param string|integer $char could be either char ('b') or char-code (98) * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') * * @throws DriverException When the operation cannot be done */ public function keyUp($xpath, $char, $modifier = null) { $this->findElement($xpath, 1); $element = $this->findElement($xpath, 1); $key = $this->normalizeCharForKeyEvent($char); $modifier = $this->keyEventModifierControl($modifier); return $this->browser->keyEvent($element["page_id"], $element["ids"][0], "keyup", $key, $modifier); } }