function DrupalSelenium2Driver::click

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

File

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

Class

DrupalSelenium2Driver
Provides a driver for Selenium testing.

Namespace

Drupal\FunctionalJavascriptTests

Code

public function click($xpath) {
    
    /** @var \Exception $not_clickable_exception */
    $not_clickable_exception = NULL;
    $result = $this->waitFor(10, function () use (&$not_clickable_exception, $xpath) {
        try {
            parent::click($xpath);
            return TRUE;
        } catch (Exception $exception) {
            if (!JSWebAssert::isExceptionNotClickable($exception)) {
                // Rethrow any unexpected exceptions.
                throw $exception;
            }
            $not_clickable_exception = $exception;
            return NULL;
        }
    });
    if ($result !== TRUE) {
        throw $not_clickable_exception;
    }
}

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