List of usage examples for org.openqa.selenium.net NetworkUtils getNonLoopbackAddressOfThisMachine
public String getNonLoopbackAddressOfThisMachine()
From source file:com.opera.core.systems.environment.webserver.WebbitAppServer.java
License:Apache License
/** * Gets the hostname of this machine. By default it will attempt to retrieve the non-loopback * address so that remote browsers can connect to the web server, but in the event that this * fails, we will fall back to the internal loopback address. * * The hostname can be overriden using the {@link #HOSTNAME_FOR_TEST_ENV_NAME} environmental * variable.// w ww. j av a 2 s . c o m * * @return hostname to use for web server */ private static String detectHostname() { String hostnameFromProperty = System.getenv(HOSTNAME_FOR_TEST_ENV_NAME); if (hostnameFromProperty != null) { return hostnameFromProperty; } NetworkUtils networkUtils = new NetworkUtils(); try { return networkUtils.getNonLoopbackAddressOfThisMachine(); } catch (WebDriverException e) { return networkUtils.getIpOfLoopBackIp4(); } }