diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index eb6a1e55..05dbcd22 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -862,6 +862,21 @@ public function keyUp($xpath, $char, $modifier = null) $this->withSyn()->executeJsOnXpath($xpath, $script); } + /** + * Simulates keyboard typing with Syn.type(). + * See: https://github.com/bitovi/syn/blob/master/src/key.js#L133 + * + * @param string $xpath + * @param string $text example: "Firstname\tLast\tmail@example.org\r" + * + */ + public function type($xpath, $text) + { + $text = json_encode($text); + $script = "Syn.type({{ELEMENT}}, $text)"; + $this->withSyn()->executeJsOnXpath($xpath, $script); + } + /** * {@inheritdoc} */