Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Selenium2Driver.php

function Selenium2Driver::getCookie

Overrides CoreDriver::getCookie

File

vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php, line 531

Class

Selenium2Driver
Selenium2 driver.

Namespace

Behat\Mink\Driver

Code

public function getCookie(string $name) {
    $cookies = $this->getWebDriverSession()
        ->getAllCookies();
    foreach ($cookies as $cookie) {
        if ($cookie['name'] === $name) {
            // PHP 7.4 changed the way it encodes cookies to better respect the spec.
            // This assumes that the server and the Mink client run on the same version (or
            // at least the same side of the behavior change), so that the server and Mink
            // consider the same value.
            if (\PHP_VERSION_ID >= 70400) {
                return rawurldecode($cookie['value']);
            }
            return urldecode($cookie['value']);
        }
    }
    return null;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal