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

Breadcrumb

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

function Selenium2Driver::selectOption

Overrides CoreDriver::selectOption

File

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

Class

Selenium2Driver
Selenium2 driver.

Namespace

Behat\Mink\Driver

Code

public function selectOption(string $xpath, string $value, bool $multiple = false) {
    $element = $this->findElement($xpath);
    $tagName = strtolower($element->name());
    if ('input' === $tagName && 'radio' === strtolower($element->attribute('type') ?: '')) {
        $this->selectRadioValue($element, $value);
        return;
    }
    if ('select' === $tagName) {
        $this->selectOptionOnElement($element, $value, $multiple);
        return;
    }
    throw new DriverException(sprintf('Impossible to select an option on the element with XPath "%s" as it is not a select or radio input', $xpath));
}
RSS feed
Powered by Drupal