3 Ways to handle SSL Error in UFT Using VBScript

In this blog post, we’ll explore how to handle SSL error in UFT using VBScript, so you can bypass these roadblocks and proceed with your automated testing smoothly. When working with Unified Functional Testing (UFT), you may encounter SSL certificate errors when automating tests on secure (HTTPS) websites. These errors usually occur if the SSL certificate is either self-signed or expired, which prevents UFT from continuing the test.

What is an SSL Error in UFT?

An SSL error occurs when UFT tries to navigate to a website with a problematic SSL certificate, causing the browser to display a warning instead of loading the webpage. This can prevent UFT from interacting with the page as expected, potentially halting your automation tests.

Why Does SSL Error Occur in UFT?

There are several reasons why SSL errors occur in UFT:

  • Self-signed certificates: Websites with certificates that are not issued by a trusted Certificate Authority (CA).
  • Expired certificates: Websites with certificates that have passed their expiration date.
  • Invalid domain: The certificate does not match the website’s domain.

While these errors are important for security, they can become a hindrance during automated testing, especially if you’re testing websites that are internal, in development, or intentionally using self-signed certificates.

How to Handle SSL Errors in UFT Using VBScript

Handling SSL errors in UFT requires simulating user interactions to bypass the certificate warnings. This can be done using VBScript to automate the browser’s behavior.

1. Bypassing SSL Errors in Internet Explorer

Internet Explorer (IE) allows you to bypass SSL warnings by clicking the “Continue to this website (not recommended)” link. You can automate this in UFT using VBScript:

' Launch Internet Explorer and navigate to a website with SSL issues
Set objBrowser = CreateObject("InternetExplorer.Application")
objBrowser.Visible = True
objBrowser.Navigate "https://your-ssl-error-website.com"

' Wait for the page to load (until the SSL error page appears)
While objBrowser.Busy
    Wait 1 ' Wait until IE finishes loading the page
Wend

' Handle SSL error by clicking on the "Continue to this website" link
On Error Resume Next
objBrowser.document.getElementById("overridelink").Click
On Error GoTo 0

' Continue your test after handling the SSL error
Wait 2
objBrowser.Navigate "https://your-ssl-error-website.com" ' Refresh to proceed

This script clicks on the “Continue to this website (not recommended)” link, allowing the browser to proceed despite the SSL error.

2. Handling SSL Errors in Chrome or Edge Using WebDriver

If you are using Selenium WebDriver with UFT for automating Chrome or Edge, you can bypass SSL errors by setting browser capabilities to accept insecure certificates. Here’s how you can do it in VBScript:

SSL Error in uft
SSl Error on Chrome
Dim driver
Set driver = CreateObject("Selenium.WebDriver")
driver.Start "chrome", "https://your-ssl-error-website.com"

' Set Chrome to ignore SSL certificate errors
Dim capabilities
Set capabilities = driver.Capabilities
capabilities.SetCapability "acceptInsecureCerts", True

driver.Get "https://your-ssl-error-website.com" ' Ignore SSL errors and proceed

3. Permanently Disable SSL Error Warnings in Internet Explorer by Modifying the Registry

If you are encountering SSL certificate errors frequently in Internet Explorer while using UFT, you can permanently disable these warnings by editing the Windows registry. Note: This is not recommended for production environments due to the potential security risks involved, as it may expose your browser to untrusted websites.

Here are the steps to disable SSL error warnings in Internet Explorer through the registry:

Step 1: Open the Windows Registry Editor

  1. Press Windows + R on your keyboard to open the Run dialog box.
  2. Type regedit and press Enter. This will open the Windows Registry Editor.
  3. If prompted by User Account Control (UAC), click Yes to allow access.

Step 2: Navigate to the Internet Explorer Security Settings

Once the Registry Editor is open, follow these steps:

1. In the left pane, navigate to the following key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

2. Alternatively, for system-wide changes (affecting all users), navigate to:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings

Step 3: Modify the Security Settings

Now, make changes to disable SSL certificate validation in Internet Explorer:

1. Look for the following DWORD values (if they don’t exist, you can create them):

  1. WarnOnHTTPSToHTTPRedirect: This disables warnings when redirecting from HTTPS to HTTP.
  2. SecureProtocols: This controls the SSL/TLS protocols that IE will use.

2. To disable the SSL warnings, you will need to adjust these values:

  1. Right-click on the WarnOnHTTPSToHTTPRedirect value, click Modify, and set its value to 0.
  2. Right-click on the SecureProtocols value, click Modify, and ensure it’s set to enable necessary protocols (usually 0xA80 for SSL 3.0, TLS 1.0, 1.1, and 1.2).

Step 4: Create a DWORD Value to Ignore Certificate Errors

To disable SSL certificate errors specifically:

  1. Right-click on the right pane, select New > DWORD (32-bit) Value.
  2. Name the new value CertificateRevocation.
  3. Right-click on CertificateRevocation, select Modify, and set its value to 0 to disable the check for revoked certificates.

Step 5: Restart Internet Explorer

After modifying the registry, close the Registry Editor and restart Internet Explorer for the changes to take effect.

Step 6: Test the Changes

  1. Open Internet Explorer and navigate to a website that previously triggered an SSL error.
  2. The SSL warning should no longer appear, allowing you to access the site directly.

Discover more from automationscript

Subscribe to get the latest posts sent to your email.

Similar Posts

Leave a Reply