Solved

Clicking a button within HTML page

Posted on 2004-04-22
11
246 Views
Last Modified: 2010-05-02
I have the handle to the class: "Internet Explorer_Server"

I don't know if it will help, but I want to be able to get my application to find an edit within a webpage, type some text in it and then click a button with "Search" as its caption on the web page.

Is this possible? And how would I go about doing this?

Thanks
0
Comment
Question by:PhilAI
  • 5
  • 2
  • 2
  • +2
11 Comments
 
LVL 11

Expert Comment

by:bingie
ID: 10894689
What is the URL of the page where the button is?
0
 
LVL 2

Expert Comment

by:gimmeadrink
ID: 10895168
0
 
LVL 11

Expert Comment

by:bingie
ID: 10895182
Some ways to do this,

Without components or references (example, thanks to ZZZZZOC):

Private Sub Form_Load()
    Dim oIE As Object, sURL As String
    sURL = "http://login.passport.net/uilogin.srf?id=2"
    Set oIE = CreateObject("InternetExplorer.Application")
    oIE.Visible = True
    Call oIE.Navigate("www.hotmail.com")
    Do Until oIE.LocationURL = sURL And oIE.readystate = 4
        DoEvents
    Loop
    oIE.document.Form1.login.Value = "email@email.com"  'replace with your id
    oIE.document.Form1.passwd.Value = "pass"  'replace with your password
    oIE.document.Form1.submit1.Click
End Sub

Or With the webbrowser component:

Webbrowser1.Document.All("Login").Click

If you want to provide the URL, it would help.

Bingie
0
 
LVL 2

Expert Comment

by:gimmeadrink
ID: 10895195
yeah, i think that was the same question, but for some reason, its not going to be the one that gets accepted...
heh, whatever works i guess.
0
 
LVL 5

Expert Comment

by:amit1978
ID: 10897169
looking for same
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 6

Author Comment

by:PhilAI
ID: 10900331
Not got the address with me here, so I'll let you guys know when I have finished work what the address is.

It is not a search button, but the 'Place Bid' I want now, decided I didn't need the search function. I want to be able to automatically place bids on eBay. So, the address depends on the item number - just pick any item on the UK eBay website as an example, and that would be feasible.

Thanks all!
0
 
LVL 6

Author Comment

by:PhilAI
ID: 10900344
0
 
LVL 6

Author Comment

by:PhilAI
ID: 10902271
OK, is it possible to navigate through the page when it is in IEXPLORE.EXE

i.e. I have the page open in the browser, and want to connect to that instance?
0
 
LVL 6

Author Comment

by:PhilAI
ID: 10902350
OK, I have found out that this can do it, but what if I want a specific window?

If IEeBayItem Is Nothing Then Set IEeBayItem = GetObject(, "InternetExplorer.Application")

I may have more than one MS IE window open at a time...
0
 
LVL 14

Accepted Solution

by:
aelatik earned 125 total points
ID: 10906434
You can loop trhough all IE instances and connect to the one you like with this code :

    Dim IE, WIN
    Set IE = CreateObject("internetexplorer.application")
    Set WIN = CreateObject("shell.application")
    For Each IE In WIN.Windows
        ' check if this is the URL you want
        If InStr(1, IE.document.Title, "eBay", vbTextCompare) > 0 Then
            ' Do your stuff with IE. this is the instance you need.
        End If
    Next IE
0
 
LVL 6

Author Comment

by:PhilAI
ID: 10907037
Spot on aelatik! I knew what I wanted to do, just didn't know how exactly.

Thanks for all your help.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

760 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

20 Experts available now in Live!

Get 1:1 Help Now