WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with MSIE
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Click on a URL on a Web Page

Keywords: 	  Click on a URL on a Web Page

Question:

How do I click on a URL link located on a web page using ole?

Link name something like: cpqlogout.htm

Answer:

That looks like a HREF (not the name),

Does the link have a NAME= or ID= ? Is it part of a Form?

If you can download the HTML and post it It'll be much easier.

It's basically similar to this...



;   with OLE you can programmatically give elements names, change their
;   styles and whatnot on the fly...

;   this works on my pc, but whether the items on the page exposed   <---------
;   by the Compaq server are "editable" or not is unknown.           <---------

;   give this a shot...


#DefineSubRoutine startMSIE()
   Browser = ObjectOpen("InternetExplorer.Application")
   Browser.addressbar = @FALSE
   Browser.statusbar = @FALSE
   Browser.menubar = @FALSE
   Browser.toolbar = @FALSE
;   Browser.fullscreen = @true
   browser.visible = @TRUE
   url = "c:\zip\test.htm"            ;  <------- change to the compaq URL and test...
   browser.navigate(url)
   WaitForPageLoad()
   ;   setup the document object...
   browserDoc = Browser.Document
   all = browserdoc.all
   Return(browser)
#EndSubRoutine

#DefineSubRoutine WaitForPageLoad()  ; assume Browser
   While browser.busy || browser.readystate == 1
      TimeDelay(0.5)
   EndWhile
   While browser.Document.ReadyState != "complete"
      TimeDelay(0.5)
   EndWhile
   Return
#EndSubRoutine



br = startMSIE()

TimeDelay(1)

all = browserdoc.all
obj = all.length

;document.forms.loginform

forms = browserdoc.forms
logform = forms.loginform          ; <-------- look only at the Login Form

numofitems = logform.length

Message("Debug", numofitems)

For o = 0 To numofitems-1
   myobj = logform.item(o)
   If myobj.type == "submit" Then Message(o, myobj.value)  ; <------- show the SUBMIT items to the user
   If myobj.value == "OK" Then myobj.name = "OKButton"     ; <------- if the button label == OK then programmmatically give it a name
Next

mybutton = all.OKButton   ;  <-------- access the named button...
mybutton.click            ;  <-------- click it...

Return
Exit

Article ID:   W15654
File Created: 2004:08:02:10:45:48
Last Updated: 2004:08:02:10:45:48