deleteCookie example


    function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = '')
    {
        Services::response()->deleteCookie($name$domain$path$prefix);
    }
}

if (function_exists('has_cookie')) {
    /** * Checks if a cookie exists by name. */
    function has_cookie(string $name, ?string $value = null, string $prefix = ''): bool
    {
        return Services::response()->hasCookie($name$value$prefix);
    }
}

  public function __construct($browserName = 'firefox', $desiredCapabilities = NULL, $wdHost = 'http://localhost:4444/wd/hub') {
    parent::__construct($browserName$desiredCapabilities$wdHost);
    ServiceFactory::getInstance()->setServiceClass('service.curl', WebDriverCurlService::class);
  }

  /** * {@inheritdoc} */
  public function setCookie($name$value = NULL) {
    if ($value === NULL) {
      $this->getWebDriverSession()->deleteCookie($name);
      return;
    }

    $cookieArray = [
      'name' => $name,
      'value' => urlencode($value),
      'secure' => FALSE,
      // Unlike \Behat\Mink\Driver\Selenium2Driver::setCookie we set a domain       // and an expire date, as otherwise cookies leak from one test site into       // another.       'domain' => parse_url($this->getWebDriverSession()->url(), PHP_URL_HOST),
      
Home | Imprint | This part of the site doesn't use cookies.