curl( 'POST', '/element', array( 'using' => $using, 'value' => $value)); } catch (NoSuchElementWebDriverError $e) { throw new NoSuchElementWebDriverError( sprintf( 'Element not found with %s, %s', $using, $value) . "\n\n" . $e->getMessage(), $e->getResults()); } return $this->webDriverElement($results['value']); } public function elements($using, $value) { $results = $this->curl( 'POST', '/elements', array( 'using' => $using, 'value' => $value )); return array_filter(array_map( array($this, 'webDriverElement'), $results['value'])); } protected function webDriverElement($value) { return array_key_exists('ELEMENT', (array) $value) ? new WebDriverElement( $this->getElementPath($value['ELEMENT']), // url $value['ELEMENT']) : // id null; } abstract protected function getElementPath($element_id); }