Click Button on Webpage via VBScript?
47,314
'Search Google
Dim objWshShell,IE,searchStr
Set objWshShell = Wscript.CreateObject("Wscript.Shell")
Set IE = CreateObject("InternetExplorer.Application")
searchStr = InputBox("Search")
With IE
.Visible = True
.Navigate "http://www.google.com"
'Wait for Browser
Do While .Busy
WScript.Sleep 100
Loop
.Document.getElementsByName("q").Item(0).Value = searchStr
.Document.getElementsByName("btnK").Item(0).Click
End With
Author by
Giacomo1968
A lady asks us for a nickel for a terrible disease but we don’t give her one we don’t like terrible diseases.
Updated on July 06, 2022Comments
-
Giacomo1968 almost 2 years
I am working on making a bot with VBScript, that opens a webpage in Internet Explorer and clicks a button. I have opening the page down, but I don't know how to click the button. I have the element. I want to do something like this:
browser.Document.All("Button_Name").Click()
-
Tmdean about 13 yearsThere isn't enough information to answer this question… The code you suggested is correct, so if that isn't working you'll need to elaborate on the specific problem if you want help troubleshooting.
-
AutomatedChaos about 13 yearsIn addition to Tmdean, try to look up what the methods
GetElementById()
andGetElementsByName()
do. They could be usefull.
-