localhost - 赛普拉斯无法加载 localhost 之外的任何内容。无法使用 CDN 或 Google 字体
问题描述
我遇到了赛普拉斯的问题,赛普拉斯打开的 Chrome 窗口无法从 jquery CDN 和 Google 字体文件访问链接的静态文件,如 jQuery。
在index.html
我得到这些行:
<script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link href="//fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
通过打开https://localhost:8000/index.html
(我必须在 HTTPS 模式下运行网站)在普通 Chrome 窗口中打开我的网站时,这些文件会加载状态代码 200,但是当赛普拉斯尝试在赛普拉斯窗口中加载它们时,我会得到(failed)
.
即使我尝试在 Cypress 窗口中打开一个新选项卡并输入除 localhost 之外的任何 URL,它也不会加载。
这是我的cypress.json
文件,我在其中禁用了chromeWebSecurity
:
{
"integrationFolder": "cypress/integration",
"supportFile": "cypress/support/index.ts",
"videosFolder": "cypress/videos",
"screenshotsFolder": "cypress/screenshots",
"pluginsFile": "cypress/plugins/index.ts",
"fixturesFolder": "cypress/fixtures",
"baseUrl": "https://localhost:8000",
"chromeWebSecurity": false,
"defaultCommandTimeout": 15000,
"pageLoadTimeout": 150000,
"viewportWidth": 1280,
"viewportHeight": 720
}
有人处理过这个问题并能够克服它吗?
解决方案
推荐阅读
- c# - EF Core 模型种子数据在键名中强加复数
- javascript - 我已经让 str="advanced frontend developer" 作为字符串我需要反向输出,如 "developer frontend advance"
- url - 我在哪里可以找到有关 URL 的“哈希”部分中特殊序列的更多信息,IE #:~:text=start%20of%20selection,end%20of%20selection
- html - 适用于 NodeJS、VueJS 的 VSC ...所见即所得的 HTML 是什么?
- c# - Visual Studio 解决方案(.sln)/C#:以另一个项目的 dll 作为参数启动一个项目
- autodesk-model-derivative - Model Derivative API - Zip 到 Svf 的翻译保持进度 0%
- c# - OpenPop.net,仅从链中提取最后一条消息
- sympy - Sympy 有没有办法简化矩阵代数?以伍德伯里身份说
- java - 为 Sardine WebDav 添加 Authorization Bearer 令牌
- ios - 如何修复线程 1:致命错误:在隐式展开可选值时意外发现 nil?