我的机器上安装了Cypress 5.0和Edge v84。当我跑的时候
> npx cypress open然后设置调试器模式
> set DEBUG=cypress:launcherCypress正在尝试在以下位置使用edge
cypress:launcher looking at possible paths... { browser: { name: 'edge', family: 'chromium', channel: 'stable', displayName: 'Edge', versionRegex: /Microsoft Edge (\S+)/m, binary: 'edge' }, exePaths: [ 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe' ] } +0ms
cypress:launcher found C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe ? false +1ms
cypress:launcher looking at possible paths... { browser: { name: 'edge', family: 'chromium', channel: 'canary', displayName: 'Edge Canary', versionRegex: /Microsoft Edge Canary (\S+)/m, binary: 'edge-canary' }, exePaths: [ 'C:\\Users\\muthu\\AppData\\Local\\Microsoft\\Edge SxS\\Application\\msedge.exe' ] } +0ms
cypress:launcher found C:\Users\muthu\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe ? false +1ms
cypress:launcher looking at possible paths... { browser: { name: 'edge', family: 'chromium', channel: 'beta', displayName: 'Edge Beta', versionRegex: /Microsoft Edge Beta (\S+)/m, binary: 'edge-beta' }, exePaths: [ 'C:\\Program Files (x86)\\Microsoft\\Edge Beta\\Application\\msedge.exe' ] } +0ms
cypress:launcher found C:\Program Files (x86)\Microsoft\Edge Beta\Application\msedge.exe ? false +1ms
cypress:launcher looking at possible paths... { browser: { name: 'edge', family: 'chromium', channel: 'dev', displayName: 'Edge Dev', versionRegex: /Microsoft Edge Dev (\S+)/m, binary: 'edge-dev' }, exePaths: [ 'C:\\Program Files (x86)\\Microsoft\\Edge Dev\\Application\\msedge.exe' ] } +0ms
cypress:launcher found C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe ? false +1ms但是边缘安装在不同的位置- C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe
如何获取Cypress identify Edge?
发布于 2021-09-07 02:23:29
如果安装在其他位置,则可以在以下路径中手动添加
cypress/plugins/index.js您需要将以下代码
const execa = require('execa')
const findBrowser = () => {
const browserPath = {Browser Path Location}
return execa(browserPath, ['--version']).then((result) => {
const [, version] = /Edge Browser (\d+\.\d+\.\d+\.\d+)/.exec(result.stdout)
const majorVersion = parseInt(version.split('.')[0])
return {
name: 'Edge',
channel: 'stable',
family: 'chromium',
displayName: 'Edge',
version,
path: browserPath,
majorVersion,
}
})
}
module.exports = (on, config) => {
return findBrowser().then((browser) => {
return {
browsers: config.browsers.concat(browser),
}
})
}参考:https://docs.cypress.io/guides/guides/launching-browsers#Customize-available-browsers
https://stackoverflow.com/questions/63742856
复制相似问题