skip to Main Content

Description:
The scrollIntoview dusk method is not working as expected.

Can anyone please point me the right version of laravel/dusk, chrome driver version to be used to make it work again.

Currently I am using theses versions while running the script.
Laravel framework version: 6.2
laravel/dusk: 6.11
php:7.2
Chrome driver: 88.0.4324.96.

Thank you in advance.

2

Answers


  1. There is a wide range of unexpected behaviours in scrollIntoView(), and related reasons…

    Among the many: my own experience was about the Bootstrap navbar placed above the scrolled element, resulting in many "Other element would receive the click" errors. I fixed it with my own Browser Macro, scrolling the element at the bottom of the page (instead of top):

    LaravelDuskBrowser::macro('scrollView', function ($selector) {
      $selector = addslashes($this->resolver->format($selector));
      $this->driver->executeScript("document.querySelector("$selector").scrollIntoView({block: 'end'});");
      $this->pause(500);
      return $this;
    });
    
    Login or Signup to reply.
  2. Had this issue today, and adding a ->maximize() just after the ->scrollIntoView and just before the click is the only thing I could get to fix it after hours of debugging. Dumb problem with a dumb solution, but much shorter and quicker than writing a custom macro.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search