Browser not launched through Cypress problem

See original GitHub issue

Current 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:

  1. Open cypress: cypress open
  2. 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:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:40 (8 by maintainers)

github_iconTop GitHub Comments

106reactions
jennifer-shehanecommented, Feb 1, 2018

So, the logs look pretty normal. 😞 Couple questions/comments.

  1. Do you see the Cypress extension little logo when you open the Chrome browser?
cy-extension
  1. If not, you could try:
  • opening up the cypress app
  • Goto File -> View App Data
  • Delete everything in here
  • Close cypress and open it up again
  • And it should recreate all the browser profiles + extension
34reactions
filiphriccommented, Sep 9, 2018

so 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/hosts file 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:

  1. open terminal, type: sudo nano /etc/hosts
  2. if nothing is present, input defaults:
##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1 localhost
fe80::1%lo0	localhost
  1. save and close. (ctrl + X then y then enter)
  2. reopen cypress and all should work normally

(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 / 500 errors)

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 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cant run cypress tests in Chrome & Edge browsers(being ...
You can try doing this: Open the cypress app (Test Runner); Go to File -> View App Data; Delete everything in here; Close...
Read more >
Launching Browsers | Cypress Documentation
When you run tests in Cypress, we launch a browser for you. This enables us to: Create a clean, pristine testing environment. Access...
Read more >
Cypress Failed to Connect to Chrome: 5 Ways to Easily Fix it
1. Update the Chrome browser. On your computer and launch Chrome. · 2. Use Chrome-flavored browsers · 3. Debug the Chrome browser ·...
Read more >
cypress-io/cypress - Gitter
@Captainvyom007_twitter I encountered a similar issue and fixed it by removing the Chrome profile that Cypress use whenever it launches Chrome.
Read more >
How to run Cypress Tests on Firefox Browser | BrowserStack
For example, by only running smoke-tests against Firefox and not Chrome, test run duration can be shortened. This level of granularity in test ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found