Search in sources :

Example 1 with HtmlSelect

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;
}
Also used : HtmlSelect(com.gargoylesoftware.htmlunit.html.HtmlSelect) HtmlOption(com.gargoylesoftware.htmlunit.html.HtmlOption)

Example 2 with HtmlSelect

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();
}
Also used : HtmlForm(com.gargoylesoftware.htmlunit.html.HtmlForm) HtmlTextInput(com.gargoylesoftware.htmlunit.html.HtmlTextInput) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) HtmlSelect(com.gargoylesoftware.htmlunit.html.HtmlSelect) HtmlButton(com.gargoylesoftware.htmlunit.html.HtmlButton)

Aggregations

HtmlSelect (com.gargoylesoftware.htmlunit.html.HtmlSelect)2 HtmlButton (com.gargoylesoftware.htmlunit.html.HtmlButton)1 HtmlForm (com.gargoylesoftware.htmlunit.html.HtmlForm)1 HtmlOption (com.gargoylesoftware.htmlunit.html.HtmlOption)1 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)1 HtmlTextInput (com.gargoylesoftware.htmlunit.html.HtmlTextInput)1