executor = $executor; } /** * @inheritdoc */ public function execute(WebDriverCommand $command) { try { return $this->executor->execute($command); } // Allow single communication timeout during test execution catch (WebDriverCurlException $exception) { // Code is not missing here } catch (UnknownErrorException|NoSuchElementException $exception) { if (strpos($exception->getMessage(), 'ode with given id') !== false) { throw new StaleElementReferenceException($exception->getMessage()); } } // Workaround for communication errors present on Jenkins catch (WebDriverException $exception) { if (strpos($exception->getMessage(), 'START_MAP') === false) { throw $exception; } } return $this->executor->execute($command); } /** * Execute custom command for WebDriver. * * @param RemoteWebDriver $driver WebDriver instance * @param array $params command parameters * * @return mixed */ public static function executeCustom(RemoteWebDriver $driver, array $params = []) { foreach (['commands', 'w3cCompliantCommands'] as $field) { if (!isset(HttpCommandExecutor::$$field['custom'])) { HttpCommandExecutor::$$field['custom'] = [ 'method' => 'POST', 'url' => '/session/:sessionId/chromium/send_command_and_get_result' ]; } } return $driver->execute('custom', $params); } }