After generating a test script using Selenium-IDE in Javascript-Mocha format, I encountered an issue with an insecure certificate when trying to access a remote URL locally.
To address the problem, I need to modify the generated TestScript to include Chrome capability for accepting insecure certificates. Unfortunately, I couldn't find any official documentation or helpful resources on this topic.
Below is the original test script:
// Generated by Selenium IDE
const {
Builder,
By,
Key,
until
} = require('selenium-webdriver')
const assert = require('assert')
describe('work', function() {
/* Test script content */
})
I attempted to make modifications as shown below:
// Modified code snippet
/* Modifications go here */
describe('work', function() {
/* Updated test script content */
})
Despite my efforts, I encountered an error while executing the modified script. https://i.sstatic.net/2aex0.png
Is there a way to enable acceptance of insecure SSL certificates in Chrome capabilities using Javascript and selenium-webdriver? Any references to official documentation would be greatly appreciated.
Thank you
UPDATE: Based on @balint's suggestion, I have revised how I initialize the builder:
var chromeCapabilities = Capabilities.chrome();
chromeCapabilities.setAcceptInsecureCerts(true);
var driver = new Builder().withCapabilities(chromeCapabilities).build();
The crucial part is setAcceptInsecureCerts
, which I found in the source code. However, even after implementing this change, the test still fails to accept the insecure certificate and proceed to the website.