Olá Rodolpho, Boa Tarde!!!
Estou acho que estou no caminho certo mas estou com duvida com relação a renderização da imagem.
Fiz um teste pegando os bytes da imagem base 64 e deu certo.
No meu caso, tenho uma imagem que está em uma página .asp e a cada atualização a imagem é alterada.
http://www.receita.fazenda.gov.br/aplicacoes/atcta/cpf/captcha/gerarCaptcha.aspcomo devo proceder neste caso que não tenho a base 64?
Veja o que fiz até agora!
public static void submittingForm() throws Exception {
// final WebClient webClient = new WebClient();
final WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_7);
webClient.setJavaScriptEnabled(true);
webClient.setRedirectEnabled(true);
webClient.setThrowExceptionOnFailingStatusCode(false);
webClient.setThrowExceptionOnScriptError(false);
webClient.setCssEnabled(false);
final HtmlPage rf = webClient.getPage("
http://www.receita.fazenda.gov.br/Aplicacoes/ATCTA/CPF/ConsultaPublica.asp");
final HtmlForm form = rf.getHtmlElementById("theForm");
final HtmlTextInput textFieldCpf = form.getInputByName("txtCPF");
final HtmlTextInput textFielCaptcha = form.getInputByName("txtTexto_captcha_serpro_gov_br");
HtmlSubmitInput consultar = form.getInputByValue("id_submit");
textFieldCpf.setValueAttribute("CPF: ");
textFielCaptcha.setValueAttribute("Digite os caracteres acima: ");
final HtmlPage page2= consultar.click();
//Go to the bob marley fan page
HtmlPage fanPage = webClient.getPage("
http://www.receita.fazenda.gov.br/Aplicacoes/ATCTA/CPF/ConsultaPublicaExibir.asp");
webClient.setJavaScriptEnabled(true);
Abraços
Joaquim