Browse files

add getValue WebElement method

  • Loading branch information...
1 parent 6ac1f28 commit d69f4cb58e9c2ca40f68eaf1fe4208927aee0b8b Austin Matzko committed Jun 1, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 WebElement.php
View
20 WebElement.php
@@ -50,6 +50,26 @@ public function getAttribute( $name = '' )
}
}
+ public function getValue()
+ {
+ $url = $this->_request_url . '/element/' . $this->session_element_id . '/value';
+ $response = json_decode( $this->_get_request( $url ) );
+ if (
+ isset( $response->value->class ) &&
+ in_array( $response->value->class, array(
+ 'org.openqa.selenium.StaleElementReferenceException',
+ ) )
+ ) {
+ if ( ! empty( $response->value->localizedMessage ) ) {
+ throw new Exception( $response->value->localizedMessage );
+ }
+ }
+
+ if ( isset( $response->value ) ) {
+ return $response->value;
+ }
+ }
+
public function isDisplayed()
{
$url = $this->_request_url . '/element/' . $this->session_element_id . '/displayed';

0 comments on commit d69f4cb

Please sign in to comment.