Cypress设置chrome浏览器运行自启动开发者工具
在plugins-》index.js文件末尾加上这一块代码,更详细的内容查看文档中的plugins相关内容 https://docs.cypress.io/api/plugins/browser-launch-api#Syntax
module.exports = (on, config) => { on('before:browser:launch', (browser = {}, launchOptions) => { // `args` is an array of all the arguments that will // be passed to browsers when it launches console.log(launchOptions.args) // print all current args if (browser.family === 'chromium' && browser.name !== 'electron') { // auto open devtools launchOptions.args.push('--auto-open-devtools-for-tabs') } if (browser.family === 'firefox') { // auto open devtools launchOptions.args.push('-devtools') } if (browser.name === 'electron') { // auto open devtools launchOptions.preferences.devTools = true } // whatever you return here becomes the launchOptions return launchOptions }) };
声明 欢迎转载,但请保留文章原始出处:) 博客园:https://www.cnblogs.com/chenxiaomeng/
如出现转载未声明 将追究法律责任~谢谢合作