Chris@14: setServiceClass('service.curl', WebDriverCurlService::class); Chris@17: } Chris@17: Chris@17: /** Chris@17: * {@inheritdoc} Chris@17: */ Chris@14: public function setCookie($name, $value = NULL) { Chris@14: if ($value === NULL) { Chris@14: $this->getWebDriverSession()->deleteCookie($name); Chris@14: return; Chris@14: } Chris@14: Chris@14: $cookieArray = [ Chris@14: 'name' => $name, Chris@14: 'value' => urlencode($value), Chris@14: 'secure' => FALSE, Chris@14: // Unlike \Behat\Mink\Driver\Selenium2Driver::setCookie we set a domain Chris@14: // and an expire date, as otherwise cookies leak from one test site into Chris@14: // another. Chris@14: 'domain' => parse_url($this->getWebDriverSession()->url(), PHP_URL_HOST), Chris@14: 'expires' => time() + 80000, Chris@14: ]; Chris@14: Chris@14: $this->getWebDriverSession()->setCookie($cookieArray); Chris@14: } Chris@14: Chris@14: }