Chris@0: phantomJSHost = $phantomJSHost; Chris@0: $this->logger = $logger; Chris@0: $this->debug = false; Chris@0: $this->createApiClient(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the value of a given element in a page Chris@0: * @param $pageId Chris@0: * @param $elementId Chris@0: * @return mixed Chris@0: */ Chris@0: public function value($pageId, $elementId) { Chris@0: return $this->command('value', $pageId, $elementId); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets a value to a given element in a given page Chris@0: * @param $pageId Chris@0: * @param $elementId Chris@0: * @param $value Chris@0: * @return mixed Chris@0: */ Chris@0: public function set($pageId, $elementId, $value) { Chris@0: return $this->command('set', $pageId, $elementId, $value); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Tells whether an element on a page is visible or not Chris@0: * @param $pageId Chris@0: * @param $elementId Chris@0: * @return bool Chris@0: */ Chris@0: public function isVisible($pageId, $elementId) { Chris@0: return $this->command('visible', $pageId, $elementId); Chris@0: } Chris@0: Chris@0: /** Chris@0: * @param $pageId Chris@0: * @param $elementId Chris@0: * @return bool Chris@0: */ Chris@0: public function isDisabled($pageId, $elementId) { Chris@0: return $this->command('disabled', $pageId, $elementId); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Drag an element to a another in a given page Chris@0: * @param $pageId Chris@0: * @param $fromId Chris@0: * @param $toId Chris@0: * @return mixed Chris@0: */ Chris@0: public function drag($pageId, $fromId, $toId) { Chris@0: return $this->command('drag', $pageId, $fromId, $toId); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Selects a value in the given element and page Chris@0: * @param $pageId Chris@0: * @param $elementId Chris@0: * @param $value Chris@0: * @return mixed Chris@0: */ Chris@0: public function select($pageId, $elementId, $value) { Chris@0: return $this->command('select', $pageId, $elementId, $value); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Triggers an event to a given element on the given page Chris@0: * @param $pageId Chris@0: * @param $elementId Chris@0: * @param $event Chris@0: * @return mixed Chris@0: */ Chris@0: public function trigger($pageId, $elementId, $event) { Chris@0: return $this->command('trigger', $pageId, $elementId, $event); Chris@0: } Chris@0: Chris@0: /** Chris@0: * TODO: not sure what this does, needs to do normalizeKeys Chris@0: * @param int $pageId Chris@0: * @param int $elementId Chris@0: * @param array $keys Chris@0: * @return mixed Chris@0: */ Chris@0: public function sendKeys($pageId, $elementId, $keys) { Chris@0: return $this->command('send_keys', $pageId, $elementId, $this->normalizeKeys($keys)); Chris@0: } Chris@0: }