Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marzocchi/53765347516f2b5e6c62657d29aa4be4 to your computer and use it in GitHub Desktop.
Save marzocchi/53765347516f2b5e6c62657d29aa4be4 to your computer and use it in GitHub Desktop.
customizing Curl Options for WebDriver client
// add the following to your testing bootstrap to override the default service class
WebDriver\ServiceFactory::getInstance()->setServiceClass('service.curl', '\\Tests\\WebDriverCurlService');
<?php
namespace Tests;
use WebDriver\Service\CurlService;
use WebDriver\Service\CurlServiceInterface;
/**
* Class WebDriverCurlService
* @package Tests
* @author mark
*/
class WebDriverCurlService extends CurlService implements CurlServiceInterface
{
/**
* @param string $requestMethod
* @param string $url
* @param array|null $parameters
* @param array $extraOptions
* @return array
* @throws \Exception
*/
public function execute($requestMethod, $url, $parameters = null, $extraOptions = array())
{
$extraOptions += [
CURLOPT_CONNECTTIMEOUT => 60,
CURLOPT_TIMEOUT => 120
];
return parent::execute($requestMethod, $url, $parameters, $extraOptions);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment