RetentionStrategy.NOOP, new ArrayList<NodeProperty<Node>>());
hudson.addNode(slave);
waitForRC();
DesiredCapabilities dc = DesiredCapabilities.htmlUnit();
dc.setCapability("jenkins.label", "foo");
WebDriver wd = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);
try {
wd.get("http://www.google.com/");
new WebDriverWait(wd, 10).until(ExpectedConditions.presenceOfElementLocated(By.tagName("title")));
} finally {
wd.quit();
}
dc = DesiredCapabilities.htmlUnit();
System.out.println("jenkins.label=foolabel");
dc.setCapability("jenkins.label", "foolabel");
try {
WebDriver dr = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);
dr.quit();
} catch (Exception e) {
fail(e.getMessage()); // should have passed
}
System.out.println("jenkins.nodeName=foo");
dc = DesiredCapabilities.htmlUnit();
dc.setCapability("jenkins.nodeName", "foo");
try {
WebDriver dr = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);
dr.quit();
} catch (Exception e) {
fail(e.getMessage()); // should have passed
}
dc.setCapability("jenkins.label", "foolabel");
System.out.println("jenkins.label=foolabel & jenkins.nodeName=foo");
try {
WebDriver dr = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);
dr.quit();
} catch (Exception e) {
fail(e.getMessage()); // should have passed
}
dc = DesiredCapabilities.htmlUnit();
dc.setCapability("jenkins.label", "bar");
System.out.println("jenkins.label=bar");
try {
new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);
fail("jenkins.label=bar should not return a valid session"); // should have failed
} catch (Exception e) {