use of org.openqa.selenium.remote.DesiredCapabilities in project selenium_java by sergueik.
the class DesiredCapabilitiesSupplier method get.
@Override
public DesiredCapabilities get() {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, proxy);
return capabilities;
}
use of org.openqa.selenium.remote.DesiredCapabilities in project zalenium by zalando.
the class TestUtils method getNewBasicRemoteProxy.
public static DockerSeleniumRemoteProxy getNewBasicRemoteProxy(String browser, String url, GridRegistry registry) throws MalformedURLException {
GridNodeConfiguration config = new GridNodeConfiguration();
URL u = new URL(url);
config.host = u.getHost();
config.port = u.getPort();
config.role = "webdriver";
RegistrationRequest req = RegistrationRequest.build(config);
req.getConfiguration().capabilities.clear();
DesiredCapabilities capability = new DesiredCapabilities();
capability.setBrowserName(browser);
req.getConfiguration().capabilities.add(capability);
return createProxy(registry, req);
}
use of org.openqa.selenium.remote.DesiredCapabilities in project zalenium by zalando.
the class ParallelIT method startWebDriverAndGetBaseUrl.
@BeforeMethod(alwaysRun = true)
public void startWebDriverAndGetBaseUrl(Method method, Object[] testArgs) throws MalformedURLException {
String zaleniumUrl = String.format("http://%s:%s/wd/hub", ZALENIUM_HOST, ZALENIUM_PORT);
String browserType = testArgs[0].toString();
Platform platform = (Platform) testArgs[1];
boolean localTesting = false;
if (testArgs.length > 2) {
localTesting = testArgs[2] != null && (boolean) testArgs[2];
}
LOGGER.info("STARTING {} on {} - {}, using {}", method.getName(), browserType, platform.name(), zaleniumUrl);
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(CapabilityType.BROWSER_NAME, browserType);
desiredCapabilities.setCapability(CapabilityType.PLATFORM_NAME, platform);
desiredCapabilities.setCapability("name", method.getName());
if (localTesting) {
desiredCapabilities.setCapability("tunnel", "true");
desiredCapabilities.setCapability("browserstack.local", "true");
desiredCapabilities.setCapability("browserstack.localIdentifier", "zalenium");
desiredCapabilities.setCapability("tunnelIdentifier", "zalenium");
}
try {
webDriver.set(new RemoteWebDriver(new URL(zaleniumUrl), desiredCapabilities));
} catch (Exception e) {
LOGGER.warn("FAILED {} on {} - {}", method.getName(), browserType, platform.name());
throw e;
}
}
use of org.openqa.selenium.remote.DesiredCapabilities in project zalenium by zalando.
the class CloudProxyHtmlRenderer method tabBrowsers.
// content of the browsers tab
private String tabBrowsers() {
List<TestSlot> testSlots = proxy.getTestSlots();
StringBuilder slotLines = new StringBuilder();
DesiredCapabilities desiredCapabilities = new DesiredCapabilities(testSlots.get(0).getCapabilities());
String version = desiredCapabilities.getVersion();
if (version != null) {
version = "v:" + version;
}
Map<String, String> linesValues = new HashMap<>();
linesValues.put("{{browserVersion}}", version);
// the lines of icons representing the possible slots
StringBuilder singleSlotsHtml = new StringBuilder();
for (TestSlot testSlot : testSlots) {
singleSlotsHtml.append(getSingleSlotHtml(testSlot));
}
linesValues.put("{{singleSlots}}", singleSlotsHtml.toString());
slotLines.append(templateRenderer.renderSection("{{tabBrowsers}}", linesValues));
return slotLines.toString();
}
use of org.openqa.selenium.remote.DesiredCapabilities in project zalenium by zalando.
the class LiveNodeHtmlRenderer method tabBrowsers.
// content of the browsers tab
private String tabBrowsers() {
StringBuilder browserSection = new StringBuilder();
for (TestSlot testSlot : proxy.getTestSlots()) {
DesiredCapabilities desiredCapabilities = new DesiredCapabilities(testSlot.getCapabilities());
String icon = getConsoleIconPath(desiredCapabilities);
String version = desiredCapabilities.getVersion();
TestSession session = testSlot.getSession();
String slotClass = "";
String slotTitle;
if (session != null) {
slotClass = "busy";
slotTitle = session.get("lastCommand") == null ? "" : session.get("lastCommand").toString();
} else {
slotTitle = testSlot.getCapabilities().toString();
}
Map<String, String> browserValues = new HashMap<>();
browserValues.put("{{browserVersion}}", Optional.ofNullable(version).orElse("N/A"));
browserValues.put("{{slotIcon}}", Optional.ofNullable(icon).orElse("N/A"));
browserValues.put("{{slotClass}}", slotClass);
browserValues.put("{{slotTitle}}", slotTitle);
browserSection.append(templateRenderer.renderSection("{{tabBrowsers}}", browserValues));
}
return browserSection.toString();
}
Aggregations