Ensuring that a valid SSL certificate is installed and properly configured on the website, protecting customer data, and ensuring a secure connection between the website and the browser.
Language: Java
Framework: Selenium 4
1//Assuming the browser driver is installed and available on the local machine23import org.openqa.selenium.WebDriver;4import org.openqa.selenium.chrome.ChromeDriver;5import org.openqa.selenium.chrome.ChromeOptions;67public class ShopifySSLTest {89public static void main(String[] args) {1011//Set the path to the local chrome driver executable12System.setProperty("webdriver.chrome.driver", "./chromedriver.exe");1314//Initialize the chrome options and set the desired capabilities15ChromeOptions options = new ChromeOptions();16options.setCapability("acceptInsecureCerts", true);1718//Create a new chrome driver instance with the desired capabilities19WebDriver driver = new ChromeDriver(options);2021//Load the Shopify website and check for SSL certificate validity22driver.get("https://www.shopify.com");23String sslCertificate = driver.findElement(By.xpath("//span[contains(text(), 'Your connection to this site is secure')]")).getText();2425if(sslCertificate.contains("secure")) {26System.out.println("SSL Certificate is properly installed and configured on the Shopify website");27} else {28System.out.println("SSL Certificate is not installed or properly configured on the Shopify website");29}3031//Close the browser instance32driver.quit();33}34}353637//To connect to a remote client with desired capabilities, use the following code:3839//Initialize the remote webdriver with the desired capabilities and URL to the remote client40WebDriver driver = new RemoteWebDriver(new URL("http://<remote-client-ip>:<port>/wd/hub"), options);4142//Load the Shopify website and perform SSL certificate validity check43driver.get("https://www.shopify.com");44//Rest of the code remains the same as above code snippet.
Language: Python
Framework: Selenium 4
1# Assumptions:2# - The web application is accessible through a valid URL3# - The SSL certificate has already been installed and properly configured on the web server4# - Selenium 4 and Python have been installed and configured on the local machine5# - The browser driver has been downloaded and placed in the PATH environment variable67from selenium import webdriver8from selenium.webdriver.common.desired_capabilities import DesiredCapabilities910# Use local driver11driver = webdriver.Chrome()1213# Connect to remote client with desired capabilities14# Uncomment the following code and update with the appropriate URL and capabilities1516# remote_driver_url = 'http://<remote_driver_url>/wd/hub'17# desired_capabilities = DesiredCapabilities.CHROME.copy()18# driver = webdriver.Remote(command_executor=remote_driver_url, desired_capabilities=desired_capabilities)1920# Navigate to Shopify webpage21driver.get("https://www.shopify.com/")2223# Verify SSL certificate is valid and properly configured24ssl_certificate = driver.execute_script("return document.getElementById('ssl-certificate')")25assert ssl_certificate.get_attribute('class') == 'valid' or ssl_certificate.get_attribute('class') == 'secure'2627# Close the browser28driver.quit()
Disclaimer: Following code snippets and related information have been sourced from GitHub and/or generated using AI code generation tools. LambdaTest takes no responsibility in the accuracy of the code and is not liable for any damages.
Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.
Test Intelligently and ship faster. Deliver unparalleled digital experiences for real world enterprises.
Start Free Testing