Select a certificate to connect to our application

I want to use Katalon in order to continuously test our web application.

I read lots of post about SSL and certificate with Katalon, and none of them is able to give me a solution:
How can I select a certificate or bypass the certificate selection that identified our clients connection with Katalon?

I still have to click on the certificate in the browser and I can’t select Katalon if there is no way for doing that automatically.

did you tried project setting > network? i think it is something there …

Yes. Of course.
The “bypass” option is activated, I configure a certificate with its password.
I tried to remove all certificates in the browser => No connection
I tried to leave just one certificate => I have to click on it

Then, no solution for bypassing certificate selection.

have you added also the certificate in the bellow line? altough not sure how this will work … i am affraid you will still have to set the exception for the certificate into the browser himself if it is not signed by a public CA.

I don’t understand: Wich below lines?

The problem is that I have to click on a certificate
Capture

And thus the test operation can’t be automated.

I don’t think it is a problem of public CA too, event though I will informed me of this.

Hi,
You can use a Java.Robot to interact with this certificate window.
Or, on IE, there is an option to automatically select the certificate if there is only one.

Edit : Depending on the type of certificate, you may also need to open the browser with a particular profile

The Robot way is interesting, but the openBrowser(“URL”) or navigateToUrl(“URL”) keywords are blocking (not asynch).

I’m new to Katalon, so if there is a way to do it asynchronisely, I beg your solution …

I’ll see if I can do a Robot that wait for the “certificates selection window” while waiting for your reply.

In my case, I have to use : open broswer, navigate to a first url, then click on the link of the site that needs a certificate. Then a delay and after I call the Robot.

check this too, if it helps:

After many tries, I found this solution. It works on Edge, Firefox and Chrome and expects the certificate you want to select is the first that appears for each browser.

I create a custom keyword for clarity, SslUI:

package your.package

import internal.GlobalVariable

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.util.KeywordUtil

import java.awt.Robot
import java.awt.event.KeyEvent

class SslUI {

	public static class ScriptContext {
		public boolean certificateSelected = false;
	}

    @Keyword
    def selectFirstCertificate(int nbIterations, ScriptContext scriptContext) {
        KeywordUtil.logInfo('Selecting certificate')

        Runnable runnable = new Runnable() {
            void run(){
                Robot robot = new Robot()

                boolean loaded = false
                int i = 0
                while (i++ < nbIterations && !scriptContext.certificateSelected) {
                    KeywordUtil.logInfo('Pushing Enter: ' + i)
					
                    robot.keyPress(KeyEvent.VK_ENTER)
                    robot.keyRelease(KeyEvent.VK_ENTER)
					robot.delay(1000);
                }

                if (scriptContext.certificateSelected) KeywordUtil.markPassed('Certficate selected successfully')
                else KeywordUtil.markFailed('Certficate not selected')
            }
        }

        new Thread(runnable).start()
    }
}

And then, in my script:

import your.package.SslUI.ScriptContext as ScriptContext

import com.kms.katalon.core.driver.DriverType
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.driver.WebUIDriverType as WebUIDriverType
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.firefox.FirefoxDriver as FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions as FirefoxOptions
import org.openqa.selenium.firefox.FirefoxProfile as FirefoxProfile
import org.openqa.selenium.firefox.ProfilesIni as ProfilesIni

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import internal.GlobalVariable as GlobalVariable


WebUI.openBrowser('')

// if you have to use a particular profil with firefox (as I do in order to recover my certificates)
DriverType executedBrowser = DriverFactory.getExecutedBrowser()
switch (executedBrowser) {
    case WebUIDriverType.FIREFOX_DRIVER:
        ProfilesIni profile = new ProfilesIni()
        FirefoxProfile FF = profile.getProfile('yourprofil')
        FirefoxOptions optionsFF = new FirefoxOptions().setProfile(FF)
        WebDriver driverFF = new FirefoxDriver(optionsFF)

        WebUI.closeBrowser()

        DriverFactory.changeWebDriver(driverFF)

        break
}

// create the context
ScriptContext scriptContext = new ScriptContext()
// run the "frenetic enter clicking job"
CustomKeywords.'com.docapost.certificate.SslUI.selectFirstCertificate'(20, scriptContext)
WebUI.navigateToUrl('https://yoururl')
// Tell your clicking job that it's good
scriptContext.certificateSelected = true

<Do something>

WebUI.closeBrowser()

hi,

for this issue i got simple solution, just add this script …
WebUI.openBrowser(’’)
WebUI.authenticate(‘yoururl.com’, ‘your.username’, ‘your.password’, 10000)

Thanks

It’s not really what I mean saying “bypass the certificate”.

The problem is that I can’t modify the way authentication is done on the application. Then I can’t authenticate with a login/password couple.