protractor - launch chrome with to disable web security for cors(protractor - 启动 chrome 以禁用 cors 的网络安全)
问题描述
所以我们的应用程序在启用 CORS 的情况下在生产环境中工作.
So our application works in production with a CORS enabled.
我有一个未在本地启用 CORS 的项目.有没有办法禁用量角器的网络安全?有没有办法给 selenium 实例添加参数?
I have a project that isn't CORS enabled locally. Is there a way to disable web security for protractor? Is there a way for me to add arguments to the selenium instance ?
我们正在寻找基于配置的解决方案.我们的本地开发机器完全锁定了我们可以安装的内容.那么这可能吗?
We're looking for a configuration based solution. Our local development machines are pretty locked down on what we can install. So is this possible?
我尝试的是设置 chrome 选项:https://github.com/angular/protractor/issues/175
What i have tried is setting chrome options: https://github.com/angular/protractor/issues/175
但这似乎只用于 chrome 扩展.
But that appears to only be used for chrome extensions.
推荐答案
还有args
在 chromeOptions
中,您可以在其中提供 --disable-web-security
和 --user-data-dir
参数.
There is also args
inside chromeOptions
, where you can provide the --disable-web-security
and --user-data-dir
arguments.
如果您在本地运行测试,请确保提供配置文件位置 用于 --user-data-dir
,否则 Chrome 将使用默认配置文件并在当前浏览器会话中加载页面(与所有扩展程序和设置一起运行).
If you are running the tests locally, make sure to supply a profile location for the --user-data-dir
, otherwise Chrome will use the default profile and load the page in the current browser session (running with all of your extensions and settings).
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['--disable-web-security', '--user-data-dir=~/.e2e-chrome-profile']
}
},
这篇关于protractor - 启动 chrome 以禁用 cors 的网络安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:protractor - 启动 chrome 以禁用 cors 的网络安全


- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07