首页 > 解决方案 > 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));

`

谢谢!对不起我的英语。

标签: javahtmlunit

解决方案


推荐阅读