Hi. I am trying to create a program that automatically inputs text in a webpage input box.

It inputs the text properly, but first it needs to focus the text box properly.

Namely, when you manually enter the text, you normally first click on the input box, then input the text. In that way the box gets focused and the written text is black. - http://prntscr.com/1hu29e

However, when entering the text from the VB program, the text is entered in the box, but it is still grey. http://prntscr.com/1hu24t .. Because of that, the inputted text is not counted as valid and when the form is submitted, an error occurs saying that no info was entered. - http://prntscr.com/1hu2uw

The code that I am currently using:

WebBrowser1.Navigate("http://www.pagesjaunes.fr/")
WebBrowser1.Document.GetElementById("quoiqui").Focus()
WebBrowser1.Document.GetElementById("quoiqui").SetAttribute("Value", "Electricien")

Any suggestions on how to focus the box so it receives data properly? The site I am trying to do this is http://www.pagesjaunes.fr/ .

Thanks in advance!

Do you have a textbox in which you enter/show a URL?then this may work:

WebBrowser1.Navigate("http://www.pagesjaunes.fr/")
        WebBrowser1.Document.GetElementById("quoiqui").Focus()
        WebBrowser1.Document.GetElementById("quoiqui").SetAttribute("Value", "Electricien")
    <name of textbox>.text=WebBrowser1.url.tostring

Hope this helps!
Yuvjeeth

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.