You are here

public function ElementContext::scrollTo in Lightning Core 8.4

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

Scrolls an element into the viewport.

@When I scroll to the :selector element

Parameters

string $selector: The element's CSS selector.

1 call to ElementContext::scrollTo()
ElementContext::click in tests/contexts/ElementContext.behat.inc
Clicks an arbitrary element, found by CSS selector.

File

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

Class

ElementContext
Contains miscellaneous step definitions for working with HTML elements.

Namespace

Acquia\LightningExtension\Context

Code

public function scrollTo($selector) {
  $this
    ->getSession()
    ->executeScript('document.querySelector("' . addslashes($selector) . '").scrollIntoView()');
}