Skip to content

Instantly share code, notes, and snippets.

@BryanHeath
Last active March 13, 2019 11:26
Show Gist options
  • Save BryanHeath/3e6f2b816302f872647fd6ca89e5dbf9 to your computer and use it in GitHub Desktop.
Save BryanHeath/3e6f2b816302f872647fd6ca89e5dbf9 to your computer and use it in GitHub Desktop.
Laravel Dusk scrollTo Macro
Browser::macro('scrollTo', function($selector) {
    $this->driver->executeScript("$(\"html, body\").animate({scrollTop: $(\"$selector\").offset().top}, 0);");
    return $this;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment