From: jp l. <jp....@gm...> - 2017-10-07 16:13:28
|
Hi Ronald, thank you for you answer and support. Where can I find latest snapshot ? I could't find it. I checkout trunk and compile that one. On Sat, Oct 7, 2017 at 5:17 PM, Ronald Brill <rb...@rb...> wrote: >>Hi There. > > Hi > >>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. > > It is always a good idea (at least if you face some problems) to use the latest snapshot build. Usually it contains some fixes and improvements. Because the snapshots are only available from builds passing the whole test suite there is no risk. > >>any clue what could be the issue ? > > Not really, i was able to get the pdf with this code (only minor changes - maybe the latest snapshot is the trick). > > public static void main(String[] args) throws Exception { > 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(6000); > > final HtmlInput cuitInput = home.getFirstByXPath("//*[@id=\"folio\"]"); > cuitInput.type(folioNumber); > > final HtmlAnchor validarButton = home.getFirstByXPath("//*[@id=\"form\"]/div/div/div[2]/div[2]/a"); > HtmlPage result = validarButton.click(); > webClient.waitForBackgroundJavaScript(6000); > // System.out.println(home.asXml()); > > > final HtmlAnchor pdfLink = result.getFirstByXPath("//*[@id=\"descargapdf\"]"); > System.out.println(pdfLink.getHrefAttribute()); > > UnexpectedPage pdf = pdfLink.click(); > // write your pdf to a file > > } > } > > RBRi > -------------------------- > WETATOR > Smart web application testing > http://www.wetator.org </rb...@rb...> |