You are here

public function FeatureContext::iClickTheElementWithCSSSelector in Open Social 8.2

Click on the element with the provided CSS Selector

@When /^I click the element with css selector "([^"]*)"$/

File

tests/behat/features/bootstrap/FeatureContext.php, line 323

Class

FeatureContext
Defines application features from the specific context.

Code

public function iClickTheElementWithCSSSelector($cssSelector) {
  $session = $this
    ->getSession();
  $element = $session
    ->getPage()
    ->find('xpath', $session
    ->getSelectorsHandler()
    ->selectorToXpath('css', $cssSelector));
  if (null === $element) {
    throw new \InvalidArgumentException(sprintf('Could not evaluate CSS Selector: "%s"', $cssSelector));
  }
  $element
    ->click();
}