【问题标题】:How to enable acceptInsecureCerts on Karate UI test如何在空手道 UI 测试中启用 acceptInsecureCerts
【发布时间】:2021-10-15 11:50:25
【问题描述】:

我正在尝试为我的网页编写一个空手道 UI 测试,该网页当前具有自签名证书,因此默认情况下被浏览器阻止。 According to the documentation,当 acceptInsecureCerts 参数启用时,应该绕过这个检查。但我找不到将此参数传递给驱动程序的正确语法。这是我的(简化的)功能文件:

Feature: browser automation 1

  Background:
    * def session = { capabilities: { acceptInsecureCerts: true } }
    * configure driver = { type: 'chrome', showDriverLog: true, showProcessLog: true, showBrowserLog: true, webDriverSession: '#(session)' }

  Scenario: load demo page
    Given driver 'https://127.0.0.1:8443/demo'
    * waitUntil('document.readyState == "complete"')
    * print 'page loaded'
    * screenshot()
    Then delay(2000).text('body')

当我运行它时,我得到了

13:31:25.237 [nioEventLoopGroup-2-1] DEBUG c.intuit.karate.driver.DriverOptions - << {"id":9,"result":{"result":{"type":"string","value":"Your connection is not private Attackers might be trying to steal your information from ...

【问题讨论】:

    标签: google-chrome testing karate ui-testing


    【解决方案1】:

    等等,chrome 不是基于 webdriver,所以webDriverSession 将不适用。它适用于chromedriver

    我进行了快速搜索,我能找到的最好的是:ignore-certificate-errors + headless puppeteer+google cloud

    所以不确定这是否有效:

    addOptions: ['--ignore-certificate-errors']
    

    请报告您的发现,以便对他人有所帮助!另一个参考是这个,但不确定它是最新的:https://peter.sh/experiments/chromium-command-line-switches

    【讨论】:

    • 哇,感谢您的快速回答!这确实对我有用:* configure driver = { type: 'chrome', addOptions: [ '--ignore-certificate-errors' ] }
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-08
    • 1970-01-01
    • 2019-11-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多