proxy = Proxy.extractFrom(desiredCapabilities);
public static Proxy extractProxy(Capabilities capabilities) { return Proxy.extractFrom(capabilities); } }
public static Proxy extractProxy(Capabilities desiredCapabilities) { return Proxy.extractFrom(desiredCapabilities); } }
public static Proxy extractProxy(Capabilities capabilities) { return Proxy.extractFrom(capabilities); } }
Settings build(Capabilities capabilities) { Map properties = new HashMap(capabilities.asMap()); Proxy proxy = Proxy.extractFrom(capabilities); if (proxy != null) { String proxyConfigString = proxy.getHttpProxy(); if (proxyConfigString != null) { Pattern pattern = Pattern.compile("(?:http(?:s)?:\\/\\/)?(?:([^:@]*):([^:@]*)@)?([^:@]*)(?::(\\d+))?"); Matcher matcher = pattern.matcher(proxyConfigString); if (matcher.matches()) { properties.put(PropertyName.PROXY_TYPE.propertyName, ProxyConfig.Type.HTTP); properties.put(PropertyName.PROXY_USERNAME.propertyName, matcher.group(1)); properties.put(PropertyName.PROXY_PASSWORD.propertyName, matcher.group(2)); properties.put(PropertyName.PROXY_HOST.propertyName, matcher.group(3)); properties.put(PropertyName.PROXY_PORT.propertyName, matcher.group(4)); } } } for (Map.Entry entry : System.getProperties().entrySet()) { properties.put(entry.getKey(), entry.getValue()); } return new Settings(this, properties); } }
private void transformCapabilities() { // transforms relative path to application into absolute Object pathToApp = getCapability(appCapability); if (pathToApp != null) { File app = new File(String.valueOf(pathToApp)); builtCapabilities.setCapability(appCapability, app.getAbsolutePath()); } //sets proxy Proxy proxy = Proxy.extractFrom(builtCapabilities); if (proxy!=null){ builtCapabilities.setCapability(proxyCapability, proxy); } // if other actions need to be implemented code will be below } }
private void transformCapabilities() { // transforms relative path to application into absolute Object pathToApp = getCapability(appCapability); if (pathToApp != null) { File app = new File(String.valueOf(pathToApp)); builtCapabilities.setCapability(appCapability, app.getAbsolutePath()); } //sets proxy Proxy proxy = Proxy.extractFrom(builtCapabilities); if (proxy!=null){ builtCapabilities.setCapability(proxyCapability, proxy); } // if other actions need to be implemented code will be below } }
/** * Drops capabilities that we shouldn't send over the wire. * * Used for capabilities which aren't BeanToJson-convertable, and are only used by the local * launcher. */ private static Capabilities dropCapabilities(Capabilities capabilities) { if (capabilities == null) { return new ImmutableCapabilities(); } MutableCapabilities caps; if (isLegacy(capabilities)) { final Set<String> toRemove = Sets.newHashSet(BINARY, PROFILE); caps = new MutableCapabilities( Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key))); } else { caps = new MutableCapabilities(capabilities); } // Ensure that the proxy is in a state fit to be sent to the extension Proxy proxy = Proxy.extractFrom(capabilities); if (proxy != null) { caps.setCapability(PROXY, proxy); } return caps; } }
/** * Note: There are two configuration modes for the HtmlUnitDriver using this constructor. * <ol> * <li>The first is where the browserName is "chrome", "firefox" or "internet explorer" * and browserVersion denotes the desired version.</li> * <li>The second one is where the browserName is "htmlunit" and the browserVersion * denotes the required browser AND its version. In this mode the browserVersion could be * "chrome" for Chrome, "firefox-38" for Firefox 38 or "internet explorer-11" for IE 11.</li> * </ol> * <p>The Remote WebDriver uses the second mode - the first mode is deprecated and should not be used. * * @param capabilities desired capabilities requested for the htmlunit driver session */ public HtmlUnitDriver(Capabilities capabilities) { this(determineBrowserVersion(capabilities)); setJavascriptEnabled(capabilities.isJavascriptEnabled()); setProxySettings(Proxy.extractFrom(capabilities)); }
proxy = Proxy.extractFrom(desiredCapabilities);
proxy = Proxy.extractFrom(desiredCapabilities);