giorgiosironi/phpunit-selenium — pull request #13 by MasonM (2012-11-07 20:30:57+00:00)
Title: Add PHPUnit_Extensions_Selenium2TestCase_Session->elementFromResponseValue()

Added a new method to PHPUnit_Extensions_Selenium2TestCase_Session called "elementFromResponseValue" that converts an array [that matches the WebElement JSON Object interface](http://code.google.com/p/selenium/wiki/JsonWireProtocol#Basic_Terms_and_Concepts) into a PHPUnit_Extensions_Selenium2TestCase_Element.

Use case: there are times where I need to find elements using JQuery, which can be done using the "execute" command with `return jQuery.find("' . $css . '")[0]` as the "script" parameter. However, I can't instantiate a Element object with the response because my TestCase class desn't have access to the driver or the URL. With "elementFromResponseValue", I can now write the following code:
```php
protected function byJquery($css) {
$elementArray = $this->execute(array(
'script' => 'return jQuery.find("' . $css . '")[0];',
'args' => array(),
));
return $this->elementFromResponseValue($elementArray);
}
```