fdulger
fdulger

Reputation: 60

How to enable acceptInsecureCerts on Karate UI test

I'm trying to write a Karate UI test for my webpage which currently has a self signed certificate and hence blocked by the browser by default. According to the documentation, when acceptInsecureCerts parameter is enabled, this check should be bypassed. But I can't find the correct syntax to pass this parameter to the driver. This is my (simplified) feature file:

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')

When I run this, I get

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 ...

Upvotes: 1

Views: 543

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

Hold on, chrome is NOT webdriver based, so the webDriverSession will not apply. It would for chromedriver.

I did a quick search and the best I could find is this: ignore-certificate-errors + headless puppeteer+google cloud

So not sure if this works:

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

Please report what you find so that it helps others ! Another reference is this, but not sure how up to date it is: https://peter.sh/experiments/chromium-command-line-switches

Upvotes: 2

Related Questions