本文整理汇总了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();
}