首页 > 解决方案 > 使用 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 运行也可以

```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"    }
  }
}

```

标签: seleniumwebdriver-iocodeceptjs

解决方案


指定窗口大小时,请尝试使用x逗号 ( ) 代替。,例子:

--window-size=1920x1080

推荐阅读