Is it possible to retrieve the value of the base url from inside a Selenium script (a plain HTML-saved script from Selenium IDE)?
What I\'m trying to do
You can use Selenium driver to get the current Url as a String, then convert the object into a URL object. Once you have done that, the Java URL class has some methods that you can use to get parts of the URL.
String url = driver.getCurrentUrl();
String domain = getDomainName( url );
public static String getDomainName( String url ) throws URISyntaxException {
URI uri = new URI(url);
String domain = uri.getHost();
return domain.startsWith("www.") ? domain.substring(4) : domain;
}