iframe - 赛普拉斯脚本 - 跨域 - iFrame 不加载
问题描述
希望一切都好。请为此请求您的帮助。我们正在执行一个启动 URL 1 - 的赛普拉斯脚本https://domain1.com
。这个网站有一个iFrame
嵌入式启动另一个网站 - https://domain2.com
. 问题是,站点 2 没有在其中加载iFrame
,我们不断收到消息 - “domain2.com 需要很长时间才能响应”。但是,如果我在 Cypress 之外启动https://domain1.com
,iFrame
则会打开并成功启动 domain2 并显示。
我已经查看了几个帖子并执行了以下操作,
cypress.json
"chromewebsecurity": false
和"modifyobstructivecode": false
index.js,然后是 package.json
const path = require('path');
module.exports = (on, config) => {
on('before:browser:launch', (browser = {}, args) => {
console.log(config, browser, args);
if (browser.name === 'chrome') {
const ignoreXFrameHeadersExtension = path.join(__dirname, '../extensions/ignore-x-frame-headers');
args.push(args.push(`--load-extension=${ignoreXFrameHeadersExtension}`));
args.push("--disable-features=CrossSiteDocumentBlockingIfIsolating,CrossSiteDocumentBlockingAlways,IsolateOrigins,site-per-process");
}
return args;
});
};
{
"name": "coral",
"version": "1.0.0",
"description": "Coral testing",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"cy:run": "C:\\Testing\\Cypress\\Coral\\node_modules\\.bin\\cypress run",
"download-extension": "ced gleekbfjekiniecknbkamfmkohkpodhe extensions/ignore-x-frame-headers"
},
"author": "",
"license": "ISC",
"devDependencies": {
"cypress": "^4.1.0",
"mochawesome": "^5.0.0",
"mochawesome-merge": "^4.0.2"
},
"reporterEnabled": "mochawesome",
"dependencies": {
"file-system": "^2.2.2",
"nodemailer": "^6.4.6",
"chrome-ext-downloader": "^1.0.4"
}
}
我已经下载了.crx
此扩展的文件并将其重命名为ignore-x-frame-headers
扩展目录下。
但是,每次我运行测试时,domain2.com 的页面都不会加载到iFrame
.
有人可以解释我缺少/执行错误的步骤吗?非常感谢您的迅速和积极的回应。
在此先感谢,Karthik。
解决方案
推荐阅读
- winapi - 为什么 GetDIBits 的 MS 示例会创建一个新的 BITMAPINFOHEADER?
- apache-spark - Pyspark 将 PipelinedRDD 转换为 Spark DataFrame
- spring - 方面的声明正在打破上下文
- vue.js - 用户第一次访问页面时如何删除工具提示?
- jenkins - Jenkins 中的 HTML 报告
- heroku - 运行混合发布时,Heroku 审查应用程序上的 Elixir 构建失败并出现 (ArgumentError) 参数错误:erlang.binary_to_atom(nil, :utf8)
- python - 绘制图表但存在范围问题
- android - 为什么我在带有 Kotlin 的 Android Studio 中使用 async{} 后会得到 LiveData 的 null 值?
- html - 在 vb.net 中的 HTML5 类型周如何获取值?
- android - 将 MutableLiveData 传递给其他 ViewModel 是否有效?