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

Breadcrumb

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

function Selenium2Driver::deselectAllOptions

Deselects all options of a multiple select

Note: this implementation does not trigger a change event after deselecting the elements.

Parameters

Element $element:

Throws

DriverException

2 calls to Selenium2Driver::deselectAllOptions()
Selenium2Driver::selectOptionOnElement in vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php
Selenium2Driver::setValue in vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php
Sets element's value by its XPath query.

File

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

Class

Selenium2Driver
Selenium2 driver.

Namespace

Behat\Mink\Driver

Code

private function deselectAllOptions(Element $element) : void {
    $script = <<<JS
var node = {{ELEMENT}};
var i, l = node.options.length;
for (i = 0; i < l; i++) {
    node.options[i].selected = false;
}
JS;
    $this->executeJsOnElement($element, $script);
}

API Navigation

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