use of io.github.bonigarcia.wdm.Config in project webdrivermanager by bonigarcia.
the class ProxyTest method getProxy.
private Optional<Proxy> getProxy(WebDriverManager browserManager) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, MalformedURLException {
Field httpClientField = WebDriverManager.class.getDeclaredField("httpClient");
httpClientField.setAccessible(true);
httpClientField.set(browserManager, new HttpClient());
Field configField = WebDriverManager.class.getDeclaredField("config");
configField.setAccessible(true);
Config config = (Config) configField.get(browserManager);
String proxy = config.getProxy();
HttpClient wdmHttpClient = (HttpClient) httpClientField.get(browserManager);
return wdmHttpClient.createProxy(proxy);
}
use of io.github.bonigarcia.wdm.Config in project selenium_java by sergueik.
the class ProxyTest method getProxy.
private Optional<Proxy> getProxy(WebDriverManager browserManager) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, MalformedURLException {
Field httpClientField = WebDriverManager.class.getDeclaredField("httpClient");
httpClientField.setAccessible(true);
httpClientField.set(browserManager, new HttpClient());
Field configField = WebDriverManager.class.getDeclaredField("config");
configField.setAccessible(true);
Config config = (Config) configField.get(browserManager);
String proxy = config.getProxy();
HttpClient wdmHttpClient = (HttpClient) httpClientField.get(browserManager);
return wdmHttpClient.createProxy(proxy);
}
Aggregations