Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
643 views
in Technique[技术] by (71.8m points)

cypress - I don't have an acess to other browsers except Chrome and Electron


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Cypress has very strict browser detection rules. On Windows (Assuming you are using win10 based on that screenshot), it looks for browser binary in Program Files and Program Files (x86).

Source: https://github.com/cypress-io/cypress/blob/develop/packages/launcher/lib/windows/index.ts#L41

If for some reason you installed Firefox in some other folder, it is possible that Cypress fails to automatically detect that browser. In such cases, --browser key comes in handy.

Get the path for your firefox.exe (How I do it: Go to properties on your firefox shortcut and copy the value in the target field) and pass it as an arg to your cypress open/run command like this

cypress open --browser "C:\PathFoo\Bar\firefox.exe"

Cypress will list the browser from the given path as Custom Firefox Browser.

Link to Doc: https://docs.cypress.io/guides/guides/launching-browsers.html#Launching-by-a-path

There are some issues with --browser on windows, like, it cannot open edge and fails to open chrome with multiple escape backslashes but should work fine for firefox.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...