You are here

public function UiTestBase::clickOnElement in Editor Advanced Image 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/UiTestBase.php \Drupal\Tests\editor_advanced_image\FunctionalJavascript\UiTestBase::clickOnElement()

Click the element with specified selector.

Parameters

string $selector_type: The element selector type (CSS, XPath).

string|array $selector: The element selector. Note: the first found element is used.

Return value

\Behat\Mink\Element\NodeElement|null The node element.

Throws

\Behat\Mink\Exception\ElementNotFoundException

1 call to UiTestBase::clickOnElement()
UiDialogTest::testImageBaseDialogWorks in tests/src/FunctionalJavascript/UiDialogTest.php
Tests CKEditor button image still apprear, works & dialog open.

File

tests/src/FunctionalJavascript/UiTestBase.php, line 64

Class

UiTestBase
Has some additional helper methods to make test code more readable.

Namespace

Drupal\Tests\editor_advanced_image\FunctionalJavascript

Code

public function clickOnElement($selector_type, $selector) {
  $element = $this
    ->getSession()
    ->getPage()
    ->find($selector_type, $selector);
  if (!$element) {
    if (is_array($selector)) {
      $selector = implode(' ', $selector);
    }
    throw new ElementNotFoundException($this
      ->getSession()
      ->getDriver(), 'element', $selector_type, $selector);
  }
  $element
    ->click();
  return $element;
}