# VBScript To Open Webpage then Click URL



## BennyBB (Sep 20, 2013)

In VBScript I want to do the following:

1. Open windows internet explorer
2. Goto a URL
3. Wait for URL to load
4. After URL is loaded, find a certain URL link  id in the html of the page from step 3.
5. Click the link.

I can do step 1, 2, 3.  But can't seem to get step 4 &5.  Any help with an example possible?  Thanks,  BennyBB


----------



## Norie (Sep 20, 2013)

Can you post what you have so far?


----------



## BennyBB (Sep 20, 2013)

Norie said:


> Can you post what you have so far?



Here it is:


```
' Visual Basic Script (VBS)
'
'
'
Option Explicit
On Error Resume Next
' Declaration of variables
Dim ie
' Declaration of subroutines
' Sub WaitForLoad waits for webpage to finish loading
' before proceeding with next line of code
Sub WaitForLoad
Do while ie.Busy
wscript.sleep 200
Loop
End Sub
' Open windows Internet explorer and surf to website
set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "www.aol.com"
ie.Toolbar=0
ie.StatusBar=0
ie.Height=560
ie.Width=1000
ie.Top=0
ie.Left=0
ie.Resizable=0
Call WaitForLoad
ie.Visible = true
'  Add code below to search html link that belongs to www.aol.com for for innerHTML "Get Free Email" then click link "Get Free Email"
```

Thanks for your help


----------

