selenium - 使用 https 的 Codeceptjs 无头测试不起作用
问题描述
当我使用 https 无头运行测试时,出现以下错误
bash
Error: move target out of bounds: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
在没有 --headless 选项的情况下运行,它可以工作但速度较慢。使用 --headless 作为 http 运行也可以
- CodeceptJS 版本:最新
- NodeJS 版本:4.2.6
- 操作系统:薄荷
- WebDriverIO:最新
- 配置文件:
```json
{
"tests": "./**/*_test.js",
"timeout": 10000,
"output": "output",
"helpers": {
"WebDriverIO": {
"smartWait": 50,
"url": "https://172.17.0.1/",
"browser": "chrome",
"restart": false,
"desiredCapabilities": {
"chromeOptions": {
"args":[
"--window-size=1200,1200",
"--headless"]
}
}
}
},
"include": {
"I": "./steps_file.js",
"loginPage": "./pages/Login.js",
"defaultData": "./Data/defaultData.js",
"registerPage": "./pages/Register.js",
"menu": "./pages/Menus.js",
"profilePage": "./pages/Profile.js",
"subscription": "./pages/Subscription.js",
"recordsPage": "./pages/Records.js"
},
"bootstrap": true,
"name": "CodeceptJS",
"plugins": {
"allure": {
"enabled": "true" }
}
}
```
解决方案
指定窗口大小时,请尝试使用x
逗号 ( ) 代替。,
例子:
--window-size=1920x1080
推荐阅读
- javascript - MongoDB shell 中 hex_md5 方法的规范在哪里
- c# - 在 SQL 中保存具有许多条件的数据,然后在保存每条记录之前从 SQL 中检索数据以进行比较
- azure - 如何在 azure devops 中为带有引用的 dot net 项目的 xamarin 项目创建 YAML 构建管道
- java - 在设计异步 Java API 时,如何确保整个 CompletableFuture 链由内部线程池执行?
- jquery - 由于 MIME 类型错误(Spring Boot 2、Thymeleaf、Bootstrap)而无法加载 javascript 文件
- ios - 如何本地化“Touch ID for”文本
- java - 在其他线程中使用蓝牙连接的 OutputStream 会干扰消息的接收
- html - Bootstrap 按钮上的自动换行不起作用
- android - 房间和调试在 WorkManager 中不起作用?
- haskell - 解析错误(可能是不正确的缩进或不匹配的括号)