How do I pull the CAPTCHA Poup with Javascript into my form in my ERP management system?

Asked

Viewed 40 times

1

The http://www.sintegra.gov.br/ is a government website with public information about companies.

When accessing the site I need to inform the CNPJ, select the UF of the CNPJ and fill the CAPTCHA...inserir a descrição da imagem aqui

I want to know how I can get this CAPTCHA box to appear for the user to fill this, within my management system. Example: User is in the customer registration screen and when filling the CNPJ field appears a CAPTCHA Poup that when filled correctly I can get the information of that CNPJ that are inside the SINTEGRA site (State Registration, street etc...)

The management system is developed in C# and I want to do this validation in Javascript!

Thanks in advance!

1 answer

0

Luciano, you can not only get the captcha of the page but you can display every page for the user inside a Webbrowser and work the events of this browser and already fill the content you want as CNPJ for example.

Example:

webBrowser.DocumentCompleted += WebBrowser_DocumentCompleted;
webBrowser.Url = new Uri("endereco_do_site_aqui");

In the method WebBrowser_DocumentCompleted you can work the page to take the HTML elements and set information in the input:

private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
      if (e.Url.ToString() == "endereco_da_pagina_de_entrada")
      {
            //----- Observe que aqui você vai estar trabalhando com o html da página, verifique na página o nome do elemento que você tem que manipular
           HtmlElement cnpj = webBrowser.Document.GetElementById("cnpj");
           cnpj.SetAttribute("value", seu_cnpj_a_ser_informado);
      }
}

Every time the user navigates the page this event is triggered, with this you can catch all the returns.

I hope I’ve helped.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.