0

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!

2
Contributors
1
Reply
11
Views
4 Years
Discussion Span
Last Post by yuvjeeth
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.