use of com.gargoylesoftware.htmlunit.html.HtmlOption in project throttle-concurrent-builds-plugin by jenkinsci.
the class ThrottleQueueTaskDispatcherTest method configureLogger.
private String configureLogger() throws IOException {
String logger = ThrottleQueueTaskDispatcher.class.getName();
r.jenkins.getLog().doNewLogRecorder(logger);
URL url = new URL(r.getURL() + logUrlPrefix + logger + "/" + configUrlSuffix);
HtmlPage page = r.createWebClient().getPage(url);
HtmlForm form = page.getFormByName(configFormName);
List<HtmlButton> buttons = HtmlUnitHelper.getButtonsByXPath(form, buttonsXPath);
String buttonText = "Add";
boolean buttonFound = false;
for (HtmlButton button : buttons) {
if (button.getTextContent().equals(buttonText)) {
buttonFound = true;
button.click();
List<HtmlInput> inputs = form.getInputsByName("_.name");
for (HtmlInput input : inputs) {
input.setValueAttribute(logger);
}
HtmlSelect select = form.getSelectByName("level");
HtmlOption option;
try {
option = select.getOptionByValue("fine");
} catch (ElementNotFoundException e) {
// gets upper case since Jenkins 1.519
option = select.getOptionByValue("FINE");
}
select.setSelectedAttribute(option, true);
break;
}
}
failWithMessageIfButtonNotFoundOnPage(buttonFound, buttonText, url);
buttonText = saveButtonText;
buttonFound = buttonFoundThusFormSubmitted(form, buttons, buttonText);
failWithMessageIfButtonNotFoundOnPage(buttonFound, buttonText, url);
return logger;
}
use of com.gargoylesoftware.htmlunit.html.HtmlOption in project maven-plugin by jenkinsci.
the class ListScmBrowsersTest method check.
private void check(Item p) throws IOException, SAXException {
HtmlPage page = j.createWebClient().getPage(p, "configure");
List<HtmlSelect> selects = DomNodeUtil.selectNodes(page, "//select");
assertTrue(selects.size() > 0);
for (HtmlSelect select : selects) {
Set<String> title = new HashSet<>();
for (HtmlOption o : select.getOptions()) {
assertTrue("Duplicate entry: " + o.getText(), title.add(o.getText()));
}
}
}
Aggregations