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

Breadcrumb

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

function BrowserKitDriver::isChecked

Overrides CoreDriver::isChecked

File

vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php, line 507

Class

BrowserKitDriver
Symfony BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

public function isChecked(string $xpath) {
    $field = $this->getFormField($xpath);
    if (!$field instanceof ChoiceFormField || 'select' === $field->getType()) {
        throw new DriverException(sprintf('Impossible to get the checked state of the element with XPath "%s" as it is not a checkbox or radio input', $xpath));
    }
    if ('checkbox' === $field->getType()) {
        return $field->hasValue();
    }
    $radio = $this->getCrawlerNode($this->getFilteredCrawler($xpath));
    return $radio->getAttribute('value') === $field->getValue();
}

API Navigation

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