Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
638 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...