java - Htmlunit 刷新页面事件
问题描述
我对这个网站有问题:https ://sistemas.tjes.jus.br/siep_consulta/faces/jsp/pesquisar_tramitacao_guias_por_pessoa_pub.jsp
我进入网站并通过“Nome da Parte”(人名)进行搜索:PAULO DA SILVA SANTOS
我点击“Pesquisar”(搜索),但在 Htmlunit 中我必须下载档案。我单击单选按钮,然后单击“gerar relatório do processo”(生成过程报告)。
当我这样做时,仅在刷新页面时才有效,但是当我转到下一页并刷新页面时,它会返回到第一页。
我该如何解决这个问题?
我的代码:`做{
for (int i = 0; i < 10; i++) {
((HtmlRadioButtonInput) page.getByXPath("//*[@id=\"formulario:masterDetail1\"]/table[2]/tbody/tr/td/input").get(i)).setChecked(true);
Page arch = ((HtmlAnchor) page.getFirstByXPath("//*[@id=\"formulario:masterDetail1\"]/table[1]/tbody/tr/td/table/tbody/tr/td[1]/a[2]")).click();
IOUtils.copy(arch.getWebResponse().getContentAsStream(),
new FileOutputStream("D:\\testepdfs\\arq" + j + ".pdf"));
page = (HtmlPage) page.refresh();
j++;
}
page = ((HtmlAnchor) page.getFirstByXPath("//*[@id=\"formulario:masterDetail1-nb\"]/tbody/tr/td[7]/a")).click();
System.err.println(page.asText());
} while (hasNextPage(page));
`
谢谢!对不起我的英语。
解决方案
推荐阅读
- python - 从浏览器下载文件时选择另存为按钮
- mysql - 每行的动态数据透视表(MySql)
- c# - Bot Framework 在活动事件的内存存储中使用
- javascript - 为 no-undef 设置忽略列表(定义来自其他来源的预期变量)
- xamarin - 具有本地内容的 Xamarin.Forms WebView 未触发导航事件
- php - example.com/wp-login.php 将我重定向到 example.com/example.com/wp-admin
- python - 将输入读入嵌套列表
- python - 基于另一个类python / django的启动增加一个类的变量
- sql - 使用 OVER 子句和 PARTITION BY 子句与计数器计算运行总计
- javascript - Office 任务窗格 window.open() -> 文档关闭时浏览器弹出窗口关闭