Need Help! VB controlling webpage

Posted on 2006-04-23
Last Modified: 2010-05-01
Hi all,

Hope anyone can help me with this. Currently stuck and have no idea.
Have a software that are installed on a machine's PC. Software runs on web browser and provides information and also upload data produce from the machine to the server by manual clicking on the browser. This software was created by the machine's vendor so it's cannot be modify.

I am now being given the task to create an auto clicking program using whatever programming language I know. For now, I am only expose to Visual Basic (beginner). Is it possible to write a program that can access the webpage's interface and do what manual action is being done? Action to be done:

1) Read data display on the browser and locate particular details to record down
2) Click on button to go to another page and key in data that was recorded
3) Click on another button to submit
4) Repeat the above

Please help! I would really appreciate it if you could advice me in detail on the codes to work on.
Thanks in advance.
Question by:magneq
    LVL 19

    Expert Comment

    You can easily do this with the WebBrowser control. It is not an easy task as you have to extract the html and then parse the html looking for the tags around the text you want.

    Clicking a submit button is very easy.

    Could you provide the URL and perhaps we can provide code.


    Author Comment

    Hi Brian,

    Thank you for your prompt reply.

    Have few question:
    1) How do you extract the html?
    2) What you meant by parsing the html?

    Checked MS site and found few stuff with WebBrowser control. I think what you are telling me is to create a program with a built in WebBrowser control where I can run the webpage in my program right? After that I am lost.

    Actually this is a software running on a "testing machine". It's located on an internal network within my company so I don't think I can bring it out.

    But it's like a normal webpage with a table on it. The table have few column with data and on one column (which we have to check manually) have data that tells us what is produced during the "machine test". If the data is critical, it will be in hyperlinked and particular image is created. I had to click on it to view the image and then save the image to the server. Then I have to click on the "continue" button to continue the testing.

    Previously the test was just normal without much failure but currently it failed quite often that it's troublesome to check, click, view, save and click continue. It will be much faster and efficient if I can do it automatically and just save what is failed.

    Hope you can help me out.
    Thanks again.



    LVL 19

    Accepted Solution

    For example to browse to a webpage you could do:


    Then in the Navigate_Complete() funciton, you could add:

    dim strHtml as string
    strHtml = webbrowser1.document.body.innerhtml

    dim strTable as string
    strTable = right(strHtml, len(strHtml) - instr(strhtml,"<table>"))
    strTable = left(strTable,instr(strTable,"</table>"))

    and you should have the table in the string StrTable You need to continue around the tags until you have the data its self.

    You might also check out the

    webbrowser1.document.body.innertext() method.

    Good Luck.

    Author Comment

    Think I get what you mean.

    Thanks man.


    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity 2008 2 39
    VBA : retain and exclude values based on a config sheet and multiple parameters 5 37
    MsgBox 2 29
    Copy a row 12 32
    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now