Browser not launched through Cypress problem
See original GitHub issueCurrent behavior:
When running any test using Chrome, the browser opens and shows the following message: This browser was not launched through Cypress. Tests cannot run., and a Run Chrome 64 button appears as well. Clicking the button launches the same browser again with the same message.
Desired behavior:
The test should be executed properly when running them on Chrome.
How to reproduce:
- Open cypress:
cypress open - Select a test in the user interface and run it (Chrome selected as the browser) Notice that the tests don’t get executed
Test code:
Not relevant to the scenario. Same behaviour happen when running cypress examples.
Additional Info (images, stack traces, etc)
At the moment, in order to workaround this issue, I close the browser, run the test using Electron, the close it down and run again using Chrome. This way the test runs properly.
This happens when starting a new instance of cypress. After having it fixed through the workaround, the tests run properly regardless of if we close the browser or not.
I uninstalled Chrome and deleted all profile information, but the issue kept happening.
Note this issue is only happening on one machine. Any help to investigate would be appreciated.
- Operating System: macOS High Sierra. Version 10.13.2 (17C88)
- Cypress Version: 1.4.1
- Browser Version: Google Chrome Version 64.0.3282.119 (Official Build) (64-bit)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:11
- Comments:40 (8 by maintainers)
Top Related StackOverflow Question
So, the logs look pretty normal. 😞 Couple questions/comments.
File->View App Dataso I did a little digging through cypress github issues and through interwebs and I found a solution that fixed my problem. the problem with this seemed to be with reaching any URL within browser, while browser itself had no problem opening.
I stumbled upon this and this issue and it seemed that some mess with localhost mapping was the core of the problem.
there is an
/etc/hostsfile on your Mac, (sorry Win guys if you have this issue too) that stores some data which probably some smarter guys than me should be able to explain. When I opened this, it was empty, so it might be a good idea to check it. I did a migration from old to new mac, so it seemed like a good idea to look for problems on default system configurations (not everything is migrated during migration apparently. I mean dude, where are my wifi passwords? ¯\_(ツ)_/¯).Anyway, since this file was empty, I basically looked what should be the defaults and copied them. Something like this:
sudo nano /etc/hostsctrl + Xthenythenenter)(you probably don’t need to copy the comments)
as I found out in those linked issues, Cypress apparently relies on this (probably the reason for throwing those
HEAD / 500errors)Anyway, this worked for me and after two days of banging my head on the wall, I’m back writing my tests on a new mac 😄