How to scroll down browser page - Laravel Dusk (Browser Tests)
Based on the answer from @james
you can execute scripts, but these cannot be chained. So you can just execute the scroll before the click occurs.
public function testExample()
{
$this->browse(function ($browser) {
$browser
->visit('http://localhost:8000/admin/login')
->driver->executeScript('window.scrollTo(0, 500);');
// can't chain methods after this
$browser
->click('label[for=test_1]')
->pause(500) //you can keep chaining here;
});
}
You can use now the script
method:
$browser->script('window.scrollTo(0, 500);');