/** * @param $script * @param array $arguments * @return mixed * @throws WebDriverException */ public function executeScript($script, array $arguments = array()) { if (!$this->driver instanceof JavaScriptExecutor) { throw new UnsupportedOperationException('driver does not implement JavaScriptExecutor'); } $this->dispatch('beforeScript', $script, $this); try { $result = $this->driver->executeScript($script, $arguments); } catch (WebDriverException $exception) { $this->dispatchOnException($exception); } $this->dispatch('afterScript', $script, $this); return $result; }
/** * @param string $javascript * @return mixed */ public function executeJs($javascript) { return $this->_webDriver->executeScript($javascript); }