function DrupalSelenium2Driver::executeJsOnElement

Same name in other branches
  1. 11.x core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php \Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver::executeJsOnElement()

Executes JS on a given element.

Parameters

\WebDriver\Element $element: The webdriver element.

string $script: The script to execute.

Return value

mixed The result of executing the script.

1 call to DrupalSelenium2Driver::executeJsOnElement()
DrupalSelenium2Driver::setValue in core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php

File

core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php, line 253

Class

DrupalSelenium2Driver
Provides a driver for Selenium testing.

Namespace

Drupal\FunctionalJavascriptTests

Code

private function executeJsOnElement(Element $element, string $script) {
    $script = str_replace('{{ELEMENT}}', 'arguments[0]', $script);
    $options = [
        'script' => $script,
        'args' => [
            $element,
        ],
    ];
    return $this->getWebDriverSession()
        ->execute($options);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.