use of com.gargoylesoftware.htmlunit.html.HtmlSelect in project java-design-patterns by iluwatar.
the class AlbumPage method changeAlbumYear.
/**
* Selects the select's option value based on the year value given
*
* @param year the new year value to set
* @return {@link AlbumPage}
*/
public AlbumPage changeAlbumYear(int year) {
HtmlSelect albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
HtmlOption yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
albumYearSelectOption.setSelectedAttribute(yearOption, true);
return this;
}
use of com.gargoylesoftware.htmlunit.html.HtmlSelect in project testcases by coheigea.
the class OIDCTest method registerNewClient.
private static HtmlPage registerNewClient(WebClient webClient, String url, String clientName, String redirectURI, String clientAudience) throws Exception {
HtmlPage registerPage = webClient.getPage(url + "/register");
final HtmlForm form = registerPage.getForms().get(0);
// Set new client values
final HtmlTextInput clientNameInput = form.getInputByName("client_name");
clientNameInput.setValueAttribute(clientName);
final HtmlSelect clientTypeSelect = form.getSelectByName("client_type");
clientTypeSelect.setSelectedAttribute("confidential", true);
final HtmlTextInput redirectURIInput = form.getInputByName("client_redirectURI");
redirectURIInput.setValueAttribute(redirectURI);
final HtmlTextInput clientAudienceURIInput = form.getInputByName("client_audience");
clientAudienceURIInput.setValueAttribute(clientAudience);
final HtmlButton button = form.getButtonByName("submit_button");
return button.click();
}
Aggregations