From: jp l. <jp....@gm...> - 2017-10-05 22:38:54
|
Hi There. I am building a spider for a web page that is generating a link for a PDF ... but I can't get the link ... I incremented the TO to 60.000 and tried different Browsers ... but not luck ... I am using 2.27 version. here is my code: public void start() throws Exception { try { String folioNumber = "928540be-cdeb-48b0-9e93-3d0f9b29fed1"; try (final WebClient webClient = new WebClient(BrowserVersion.BEST_SUPPORTED)) { webClient.getOptions().setThrowExceptionOnScriptError(false); final HtmlPage home = webClient.getPage("https://www.afphabitat.cl/herramientas-y-servicios/validar-certificados/"); webClient.waitForBackgroundJavaScript(60000); final HtmlInput cuitInput = home.getFirstByXPath("//*[@id=\"folio\"]"); cuitInput.setValueAttribute(folioNumber); final HtmlAnchor validarButton = home.getFirstByXPath("//*[@id=\"form\"]/div/div/div[2]/div[2]/a"); HtmlPage result = validarButton.click(); webClient.waitForBackgroundJavaScript(60000); final HtmlAnchor pdfLink = result.getFirstByXPath("//*[@id=\"descargapdf\"]"); Assert.assertTrue(StringUtils.isNotEmpty(pdfLink.getHrefAttribute())); } } catch (Exception e) { throw e; } } any clue what could be the issue ? |