diff --git a/lib/remote/HttpCommandExecutor.php b/lib/remote/HttpCommandExecutor.php index a1a46a37a..698ceb403 100644 --- a/lib/remote/HttpCommandExecutor.php +++ b/lib/remote/HttpCommandExecutor.php @@ -79,6 +79,7 @@ class HttpCommandExecutor implements WebDriverCommandExecutor { 'sendKeys' => array('method' => 'POST', 'url' => '/session/:sessionId/keys'), 'sendKeysToAlert' => array('method' => 'POST', 'url' => '/session/:sessionId/alert_text'), 'sendKeysToElement' => array('method' => 'POST', 'url' => '/session/:sessionId/element/:id/value'), + 'getValue' => array('method' => 'GET', 'url' => '/session/:sessionId/element/:id/value'), 'setImplicitWaitTimeout' => array('method' => 'POST', 'url' => '/session/:sessionId/timeouts/implicit_wait'), 'setScreenOrientation' => array('method' => 'POST', 'url' => '/session/:sessionId/orientation'), 'setPageLoadTimeout' => array('method' => 'POST', 'url' => '/session/:sessionId/timeouts'), @@ -95,6 +96,7 @@ class HttpCommandExecutor implements WebDriverCommandExecutor { 'touchMove' => array('method' => 'POST', 'url' => '/session/:sessionId/touch/move'), 'touchScroll' => array('method' => 'POST', 'url' => '/session/:sessionId/touch/scroll'), 'touchUp' => array('method' => 'POST', 'url' => '/session/:sessionId/touch/up'), + 'touchElement' => array('method' => 'POST', 'url' => '/session/:sessionId/element/:id/touch'), ); protected $url; diff --git a/lib/remote/RemoteWebElement.php b/lib/remote/RemoteWebElement.php index 1c7816e90..d96b5304b 100644 --- a/lib/remote/RemoteWebElement.php +++ b/lib/remote/RemoteWebElement.php @@ -248,17 +248,38 @@ public function isSelected() { * Simulate typing into an element, which may set its value. * * @param mixed $value The data to be typed. + * @param boolean $done_after Press the enter/blur to fire change event * @return WebDriverElement The current instance. */ - public function sendKeys($value) { + public function sendKeys($value, $done_after = false) { $params = array( 'value' => WebDriverKeys::encode($value), + 'done_after' => $done_after, ':id' => $this->id, ); $this->executor->execute('sendKeysToElement', $params); return $this; } + /** + * Get the current value of the element + * + * @return string The value of the element + */ + public function getValue() { + return $this->executor->execute('getValue', array(':id' => $this->id)); + } + + /** + * Touch the element + * + * @return WebDriverElement The current instance. + */ + public function touch($relative_x, $relative_y) { + $this->executor->execute('touchElement', array(':id' => $this->id)); + return $this; + } + /** * If this current element is a form, or an element within a form, then this * will be submitted to the remote server.