use of org.openqa.selenium.Proxy in project jmeter-plugins by undera.
the class ProxyFactoryTest method shouldCreateDirectProxy.
@Test
public void shouldCreateDirectProxy() {
Proxy proxy = factory.getDirectProxy();
assertThat(proxy.getProxyType(), is(Proxy.ProxyType.DIRECT));
}
use of org.openqa.selenium.Proxy in project selenium_java by sergueik.
the class RecordSettingsBase method prepareRecord.
@Override
public void prepareRecord(int timeout) {
this.proxy = new BrowserMobProxySupplier(timeout, requestFilter, responseFilter).get();
Proxy seleniumProxy = new SeleniumProxySupplier(proxy).get();
DesiredCapabilities desiredCapabilities = new DesiredCapabilitiesSupplier(seleniumProxy).get();
this.driver = webDriverSupplier.get(desiredCapabilities);
this.driver.manage().window().maximize();
}
use of org.openqa.selenium.Proxy in project Asqatasun by Asqatasun.
the class ProfileFactory method setUpProxy.
private void setUpProxy(FirefoxProfile firefoxProfile) {
if (!StringUtils.isEmpty(proxyPort) && !StringUtils.isEmpty(proxyHost)) {
StringBuilder strb = new StringBuilder(proxyHost);
strb.append(":");
strb.append(proxyPort);
Proxy proxy = new Proxy();
proxy.setFtpProxy(strb.toString());
proxy.setHttpProxy(strb.toString());
proxy.setSslProxy(strb.toString());
if (StringUtils.isNotEmpty(proxyExclusionUrl)) {
proxy.setNoProxy(proxyExclusionUrl.replaceAll(";", ","));
}
firefoxProfile.setProxyPreferences(proxy);
}
}
use of org.openqa.selenium.Proxy in project opennms by OpenNMS.
the class DatabaseReportIT method customizeCapabilities.
// setup proxy and response filter
@Override
protected void customizeCapabilities(DesiredCapabilities caps) {
proxy = new BrowserMobProxyServer();
proxy.start(0);
proxy.addResponseFilter(new ResponseFilter() {
@Override
public void filterResponse(HttpResponse response, HttpMessageContents contents, HttpMessageInfo messageInfo) {
if (isReportDownloadResponse(response)) {
LOG.info("Report download response received with headers: {}", response.headers().entries());
try (ByteArrayInputStream input = new ByteArrayInputStream(contents.getBinaryContents());
FileOutputStream output = new FileOutputStream(getFile())) {
ByteStreams.copy(input, output);
} catch (IOException e) {
Throwables.propagate(e);
}
}
}
});
// configure the Browser Mob Proxy as a desired capability
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
caps.setCapability(CapabilityType.PROXY, seleniumProxy);
}
use of org.openqa.selenium.Proxy in project fess by codelibs.
the class WebDriverGenerator method createDriverService.
@SuppressWarnings("deprecation")
protected PhantomJSDriverService createDriverService(final Capabilities desiredCapabilities) {
// Look for Proxy configuration within the Capabilities
Proxy proxy = null;
if (desiredCapabilities != null) {
proxy = Proxies.extractProxy(desiredCapabilities);
}
// Find PhantomJS executable
String phantomjspath = null;
if (desiredCapabilities != null && desiredCapabilities.getCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY) != null) {
phantomjspath = (String) desiredCapabilities.getCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY);
} else {
phantomjspath = CommandLine.find(PHANTOMJS_DEFAULT_EXECUTABLE);
phantomjspath = System.getProperty(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjspath);
}
final File phantomjsfile = new File(phantomjspath);
// Build & return service
return //
new Builder().usingPhantomJSExecutable(phantomjsfile).usingAnyFreePort().withProxy(//
proxy).withLogFile(//
new File(ComponentUtil.getSystemHelper().getLogFilePath(), "phantomjs.log")).usingCommandLineArguments(//
findCLIArgumentsFromCaps(desiredCapabilities, PhantomJSDriverService.PHANTOMJS_CLI_ARGS)).build();
}
Aggregations