protractor - launch chrome with to disable web security for cors

后端 未结 2 657
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-08 00:39

So our application works in production with a CORS enabled.

I have a project that isn\'t CORS enabled locally. Is there a way to disable web security for protractor? Is

2条回答
  •  南旧
    南旧 (楼主)
    2021-02-08 01:41

    @alecxe's solution wasn't working for me. I eventually came up with the following after some cli trial and error; I'm sharing my solution here (it took some hair pulling to figure it out) in case there are other lost souls out there having the same problem:

    capabilities: {
        browserName: 'chrome',
        chromeOptions: {
            args: ['--disable-web-security', '--user-data-dir']
        }
    }
    

    Cheers!

提交回复
热议问题