All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.version1.webdriver.configuration.SauceLabsCredentials Maven / Gradle / Ivy

Go to download

A simple Selenium framework offering externalised configuration, a good selection of libraries for supporting test data, simple WebDriver browser binary resolution and an opinionated approach for WebDriver test design.

The newest version!
package com.version1.webdriver.configuration;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.version1.exceptions.SauceLabsCredentialsException;

public class SauceLabsCredentials {

    private static final Logger logger = LoggerFactory.getLogger(SauceLabsCredentials.class);
    private String username;
    private String accessKey;

    public SauceLabsCredentials() throws SauceLabsCredentialsException {
        this.username = System.getenv("SAUCE_USERNAME");
        this.accessKey = System.getenv("SAUCE_ACCESS_KEY");

        if(!areCredentialsValid()) {
            logger.error("One or both of SauceLabs credentials are null - ensure environment variables for SAUCE_USERNAME and SAUCE_ACCESS_KEY are set");
            throw new SauceLabsCredentialsException();
        }
    }

    private boolean areCredentialsValid() {
        return username != null || accessKey != null;
    }

    public String getUsername() {
        return this.username;
    }

    public String getAccessKey() {
        return this.accessKey;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy