dusk: $browser->dump() always returns empty or blank html content
I have the same problem as this person: https://stackoverflow.com/questions/46868606/get-laravel-dusk-to-run-properly-on-ubuntu-16-wt-laravel-5-5
$this->browse(function (Browser $browser) {
$browser->visit('/')
->dump()
;
});
this returns "<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>"
That HTML is not generated by any of my blade files and it is affecting all my URLs.
None of my assertions will work because dusk is getting that instead of my app.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 27 (8 by maintainers)
Indeed, this is probably due to invalid SSL certificates.
If you are running Chrome 65+ and Chrome Driver 2.35+ you can add the following in
DuskTestCase:It should do the trick
also you can comment ‘–headless’ and add ‘–ignore-certificate-errors’, in tests/DuskTestCase.php after in visit method use full url. I investigate this case and edit my response later
I was getting an empty HTML response when using
selenium/standalone-chromewith a Docker service calledselenium. I had to modify thedriver()function to the following:where
DUSK_BROWSER_URL=http://selenium:4444/wd/hubon my.env.dusk.localIt was the correct path from my .env file. After changing the
https://tohttp://, it started returning results from my application.It looks like dusk silently breaks on SSL errors?
I was also facing the same issue and get it resolved by starting my server using “php artisan serve” command and changed value of APP_URL in .env.dusk.local file to the url returned after starting server. Hope this will help someone.
SSH to your homestead machine:
Add
where
192.161.10.15is the ip address defined inHomestead.yamlfile andmysite.localis your local url.@clemblanco Faced with the same issue. But your fix didn’t work. Here is my docker-compose.yml:
Update: My mistake. Just should use the correct URL during testing. Just change url to
http://NAME_OF_CONTAINER_WHERE_NGINX_PLACEDIn my case I’ve changed:
If you look at the value of
$urlin this line: https://github.com/laravel/dusk/blob/3.0/src/Browser.php#L136 Is it the correct URL to your site?Are you running Laravel in Homestead?
Does it work with a site like https://google.com?