Laravel Dusk provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require you to install JDK or Selenium on your machine. Instead, Dusk uses a standalone ChromeDriver installation. However, you are free to utilize any other Selenium compatible driver you wish.
Questions tagged [laravel-dusk]
477 questions
10
votes
9 answers
Laravel Dusk - Class config does not exist
recently upgraded a 5.3 project to 5.4 and all seemed good.
Today I started to implement Dusk however had hit an issue when running the example test
☁ footy-finance [5.4] ⚡ php artisan dusk
PHPUnit 6.0.0 by Sebastian Bergmann and contributors.
E …

owenmelbz
- 6,180
- 16
- 63
- 113
9
votes
1 answer
Class 'Laravel\Dusk\DuskServiceProvider' not found
I updated composer using
composer update
having error
To resolve this i tried to do composer require --dev laravel/dusk
This is throwing
Any thing which i am missing ?
Please assist.

Abdul Qadir R.
- 1,059
- 3
- 9
- 26
8
votes
4 answers
How can I check if element is present in laravel dusk test?
In the below code, I want to check if the element is present at XPath, then only it should execute code.
if($browser->driver->findElement(WebDriverBy::xpath('/html/body/div[1]/div/section/div[3]/div[2]/div/table/tbody/tr['.$i.']/td[2]'))!==null)
{…

Rushi
- 81
- 1
- 1
- 5
8
votes
2 answers
Laravel Phpunit and Dusk with CircleCI
Has anybody been able to get Laravel Dusk working on CircleCI.
I can get my build working and tested with PHPUnit but it fails for Laravel Dusk.
I have a base Laravel installation with Dusk installed. When I get to the php artisan dusk command, I…

whoacowboy
- 6,982
- 6
- 44
- 78
7
votes
8 answers
Laravel Reset Database after Test
I have just started using Laravel Dusk to test my project and need some guidance. After I run all the tests available, I want to be able to reset my database back to before I run the tests. (If there were any entries in my database before I run the…

Jennifer Zhou
- 323
- 1
- 7
- 20
7
votes
5 answers
How to create .env file for test with Laravel Dusk
I'm using Dusk to do a simple login test.
I created a .env.dusk file so that the test uses an alternate database and does not delete the data that was registered on the platform.
Archive…

Lucas Lopes
- 1,373
- 3
- 14
- 23
7
votes
1 answer
Set up Laravel 5.4 with Dusk using phpunit.xml, .env.dusk.local, and an sqlite in-memory database
The title says it all. I would like to know how to properly set up a new Laravel 5.4 project with Dusk, using an in-memory SQLite database.
I can run the tests, but I get an error: "No such table: users"
I have created a new Laravel 5.4…

Michael
- 4,282
- 9
- 55
- 89
6
votes
2 answers
Connection Refused while Runing Laravel Dusk with Laravel Sail
I'm trying to use Laravel Dusk integrated with Laravel Sail as described in: https://laravel.com/docs/8.x/sail#laravel-dusk
I'm facing some problems when it comes to make this work:
If a use, a .env.dusk or .env.dusk.local file and run the tests…

C0lliNN
- 61
- 1
- 2
6
votes
3 answers
Laravel Dusk screenshot
I'm using laravel 5.6 and Dusk for running some tests.
I'm always taking my screenshot like this
...
use Facebook\WebDriver\WebDriverDimension;
...
class LoginTest extends DuskTestCase
{
public function testLogin()
{
$user =…

Atnaize
- 1,766
- 5
- 25
- 54
6
votes
2 answers
Log Javascript console output in Laravel Dusk
I am using Laravel 5.6 and Laravel Dusk 3.0.9.
Dusk is pretty handy, but when a test fails on a page where there is some Javascript functionality it can be pretty hard to work out what went wrong. Dusk generates a screenshot, which helps, but what…

Don't Panic
- 13,965
- 5
- 32
- 51
6
votes
2 answers
Laravel Dusk - Reuse browser with its session and cookies
I've just used Laravel Dusk to test a javascript site.
Want to reuse the current browser with its session and cookies for some reason (keep me logged in on the site), so I don't need to pass auth process.
Any way to reuse the current browser?
I've…

Arie Pratama
- 95
- 2
- 7
6
votes
2 answers
Laravel Dusk returns empty html document when dumping browser, assertions therefore fail
I have a project which came from laravel 5.1, we have upgraded it accordingly up until 5.6, everything on the application works perfectly fine. When I install dusk and run this on ExampleTest.php:
$this->browse(function (Browser $browser) {
…

Diego Ponciano
- 453
- 5
- 12
6
votes
4 answers
Laravel dusk doesn't see vuejs selectors
I am trying to run laravel dusk with vuejs and I got an error
1) Tests\Browser\UserCreateTest::testAdminCanCreateAnotherUser
Facebook\WebDriver\Exception\TimeOutException: Waited 5 seconds for selector [.users].
This is my…

Artem Petrusenko
- 71
- 3
6
votes
4 answers
Class 'Tests\DuskTestCase' not found in ExampleTest.php
I am trying to run Laravel Dusk tests, but when I run the test, a new Chrome tab pops up with this message.
Fatal error: Class 'Tests\DuskTestCase' not found in path-to-project\tests\Browser\ExampleTest.php on line 9
All I have done so far is run…

larjae
- 302
- 3
- 13
6
votes
2 answers
Get the source code of an element
Is there a similar way in Laravel Dusk as we have in Selenium, to get the source code of an element by 'innerHTML attribute'?
Ex: innerHTML for
Hello
would be:
Hello World!
World!
.
shaebi
- 99
- 2
- 10