public function ElementContext::click in Lightning Core 8
Same name and namespace in other branches
- 8.5 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::click()
- 8.2 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::click()
- 8.3 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::click()
- 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 391
Class
- ElementContext
- Contains miscellaneous step definitions for working with HTML elements.
Namespace
Acquia\LightningExtension\ContextCode
public function click($selector) {
$element = $this
->assertSession()
->elementExists('css', $selector);
try {
$this
->scrollTo($selector);
} catch (UnsupportedDriverActionException $e) {
// Don't worry about it.
}
$element
->click();
}