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

com.nordstrom.automation.selenium.exceptions.InvalidGridHostException Maven / Gradle / Ivy

Go to download

Selenium Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium (WebDriver).

There is a newer version: 28.3.1-s4
Show newest version
package com.nordstrom.automation.selenium.exceptions;

import java.net.MalformedURLException;

import org.apache.http.HttpHost;

/**
 * This exception is thrown to indicate that the Selenium Grid host specification is malformed.
 */
public class InvalidGridHostException extends RuntimeException {

    private static final long serialVersionUID = -3037697283479571401L;
    private static final String TEMPLATE = "Specified Selenium Grid %s host URI '%s' is malformed";

    /**
     * Constructor for {@code invalid host} exception with the specified role and host.
     * 
     * @param role Grid server role specifier ({@code hub} or {@code node})
     * @param host Grid server host specifier
     * @param cause the cause of this exception
     */
    public InvalidGridHostException(final String role, final HttpHost host, final MalformedURLException cause) {
        super(getMessage(role, host), cause);
    }
    
    /**
     * Get exception message for the specified role and host.
     * 
     * @param role Grid server role specifier ({@code hub} or {@code node})
     * @param host Grid server host specifier
     * @return exception message for the specified role and host
     */
    private static String getMessage(final String role, final HttpHost host) {
        return String.format(TEMPLATE, role, host.toURI());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy