本文整理匯總了Java中com.gargoylesoftware.htmlunit.html.HtmlPage.getHtmlElementById方法的典型用法代碼示例。如果您正苦於以下問題:Java HtmlPage.getHtmlElementById方法的具體用法?Java HtmlPage.getHtmlElementById怎麽用?Java HtmlPage.getHtmlElementById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.gargoylesoftware.htmlunit.html.HtmlPage
的用法示例。
在下文中一共展示了HtmlPage.getHtmlElementById方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: putObservation
import com.gargoylesoftware.htmlunit.html.HtmlPage; //導入方法依賴的package包/類
public void putObservation(String observation, String observationURL) throws IOException {
HtmlPage pagina = conn.getPage(observationURL);
if (pagina.getTitleText().equals(SuapConnection.SUAP_LOGIN_PAGE_TITLE)) {
pagina = login(observationURL);
}
HtmlForm formulario = pagina.getHtmlElementById("observacao_form");
HtmlTextArea whereToInsertObs = formulario.getTextAreaByName("descricao");
HtmlSubmitInput sendBtn = formulario.getInputByName("observacao_form");
whereToInsertObs.setText(observation);
sendBtn.click();
}
示例2: resetADPassword
import com.gargoylesoftware.htmlunit.html.HtmlPage; //導入方法依賴的package包/類
public void resetADPassword(String user, String newPass) throws IOException {
String url = SuapConnection.SUAP_AD_RESET_PASSWD_BASE_URL + user + "/";
System.out.println("Resetando a senha para " + user);
HtmlPage pagina = conn.getPage(url);
if (pagina.getTitleText().equals(SuapConnection.SUAP_LOGIN_PAGE_TITLE)) {
pagina = login(url);
}
HtmlForm formulario = pagina.getHtmlElementById("changepassword_form");
HtmlPasswordInput senha1 = formulario.getInputByName("password");
HtmlPasswordInput senha2 = formulario.getInputByName("password_confirm");
senha1.setText(newPass);
senha2.setText(newPass);
HtmlSubmitInput sendBtn = formulario.getInputByName("changepassword_form");
sendBtn.click();
}