You are here

public function ElementContext::click in Lightning Core 8.3

Same name and namespace in other branches
  1. 8.5 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::click()
  2. 8 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::click()
  3. 8.2 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::click()
  4. 8.4 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::click()

Clicks an arbitrary element, found by CSS selector.

@When I click the :selector element

Parameters

string $selector: The CSS selector.

File

tests/contexts/ElementContext.behat.inc, line 398

Class

ElementContext
Contains miscellaneous step definitions for working with HTML elements.

Namespace

Acquia\LightningExtension\Context

Code

public function click($selector) {
  $element = $this
    ->assertSession()
    ->elementExists('css', $selector);
  try {
    $this
      ->scrollTo($selector);
  } catch (UnsupportedDriverActionException $e) {

    // Don't worry about it.
  }
  $element
    ->click();
}