"InvalidSessionIdException: invalid session id" Error in browser test on disk in laravel 6.0

Asked 1 years ago, Updated 1 years ago, 72 views

Code Affected

I don't know how to resolve the error in the next test on laravel disk

class HomeTest extensions DuskTestCase
{
    /**
     * ADask test example.
     *
     * @return void
     */
    public function testExample()
    {
        $this->browse(function(Browser$browser){
            $browser->visit('/register')
            ->assertSee('User Registration');
    }
}


Test Run Error

There was 1 error:

1) Tests\Browser\HomeTest::testExample
Facebook\WebDriver\Exception\InvalidSessionIdException: invalid session id

/var/www/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php: 107
/var/www/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:370
/var/www/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:590
/var/www/vendor/php-webdriver/webdriver/lib/Remote/RemoteExecuteMethod.php:27
/var/www/vendor/php-webdriver/webdriver/lib/WebDriverOptions.php:166
/var/www/vendor/larvel/dusk/src/Browser.php:369
/var/www/vendor/larvel/dusk/src/Concerns/ProvidesBrowser.php:161
/var/www/vendor/larvel/framework/src/Illuminate/Support/Trits/EnumeratesValues.php:176
/var/www/vendor/larvel/dusk/src/Concerns/ProvidesBrowser.php: 162
/var/www/vendor/larvel/dusk/src/Concerns/ProvidesBrowser.php: 78
/var/www/Tests/Browser/HomeTest.php:27

Caused by
Facebook\WebDriver\Exception\InvalidSessionIdException: invalid session id

/var/www/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php: 107
/var/www/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:370
/var/www/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:590
/var/www/vendor/php-webdriver/webdriver/lib/Remote/RemoteExecuteMethod.php:27
/var/www/vendor/php-webdriver/webdriver/lib/Remote/RemoteTargetLocator.php:38
/var/www/vendor/larvel/dusk/src/Browser.php:271
/var/www/vendor/larvel/dusk/src/Concerns/ProvidesBrowser.php: 141
/var/www/vendor/larvel/framework/src/Illuminate/Support/Trits/EnumeratesValues.php:176
/var/www/vendor/larvel/dusk/src/Concerns/ProvidesBrowser.php: 147
/var/www/vendor/larvel/dusk/src/Concerns/ProvidesBrowser.php:70
/var/www/Tests/Browser/HomeTest.php:27

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

When I searched for a similar error, there was information that the shortage of shm_size in the docker container was the cause, but there is plenty of room for /dev/shm, so it seems to be another cause.
It's my first time testing with phpunit, so I'd appreciate it if you could let me know.

Supplementary information (for example, FW/Tool Version)

I installed the disk for your reference.
Lavel 6.x Lavel Desk

The app_url environment variable in .env.dusk.local matches the URL of the application accessed through the browser

Ravel Framework 6.18.3
Google Chrome 80.0.3987.149
ChromeDriver 80.0.3987.106

php docker laravel phpunit

2022-09-29 21:33

1 Answers

·Restart all containers
·Create a new environment by cloning the project to a different directory

It's not a fundamental solution, but
Doing the above two things may solve the problem.


2022-09-29 21:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.