You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决Katalon运行时Chrome无头模式出现“您的连接不是私密连接”问题

解决Katalon Chrome无头模式下"您的连接不是私密连接"报错方案

方法1:全局Desired Capabilities配置(优先使用)

  • 打开Katalon Studio对应项目,依次进入「Project」>「Settings」>「Desired Capabilities」>「Web UI」>「Chrome」
  • 点击添加按钮,新增2条配置项:
    • 第一条:Name填args,Type选List,Value添加三个字符串值:--headless=new、--ignore-certificate-errors、--allow-insecure-localhost
    • 第二条:Name填acceptInsecureCerts,Type选Boolean,Value设为true
  • 保存配置后重新执行测试用例即可。

方法2:测试用例内动态配置(全局配置不生效时使用)

如果测试用例需要单独定义启动参数,可直接在脚本中添加Chrome配置,示例代码如下:

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import org.openqa.selenium.chrome.ChromeOptions
import com.kms.katalon.core.webui.driver.DriverFactory

// 自定义Chrome启动参数
ChromeOptions options = new ChromeOptions()
options.addArguments("--headless=new")
options.addArguments("--ignore-certificate-errors")
options.addArguments("--allow-insecure-localhost")
options.setAcceptInsecureCerts(true)

// 应用配置启动浏览器
DriverFactory.changeWebDriver(options)
WebUI.openBrowser("你的测试站点地址")
// 后续接测试逻辑

注意:

  1. 必须使用--headless=new参数而非旧版的--headless,旧版Chrome无头模式采用独立内核,不会生效证书忽略配置。
  2. 若使用的Chrome版本低于112,建议先升级到最新稳定版,或额外添加--ignore-certificate-errors-spki-list参数配置目标站点的证书哈希。

内容的提问来源于stack exchange,提问作者Aenx

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.27 12:45:02