Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Based the link above how to simulate click event

sal21

Programmer
Apr 26, 2004
489
IT

Possibile to simulate the click event on Aggiorna but set bifore the year 2024?
Please without IE object.
Naturally in VB 6.0
 
>imulate the click event

Without the IE engine you'll need something like the WebView2 control or Selenium. XMLHTTP only sends HTTP requests and does not parse or run JavaScript or HTML like a browser does (under certain circumstances it is possible to emulate what the click event does, but I don't think that is the case here; happy to proved wrong though)
 
ok strongm,
can you create a code to use IE.
Tks as usual.

But before to click on "aggiorna" i need to set one item from dropdown "year", actually is 2025, but i need to set more...
 
wow...
found this code:

Sub TEST_CLICK()

Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer

Dim oHTML_Element As IHTMLElement
Dim sURL As String

On Error GoTo Err_Clear
sURL = "https://www.oklotto.it/ambi-frequenti.php"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True

oBrowser.Navigate sURL
'oBrowser.Visible = True

Do
Loop Until oBrowser.ReadyState = READYSTATE_COMPLETE

Set HTMLDoc = oBrowser.Document

For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "button" Then oHTML_Element.CLICK
Exit For
Next

Err_Clear:
If Err <> 0 Then
Debug.Assert Err = 0
Err.Clear
'Resume Next
End If
End Sub

but before to click opn "Aggiorna i ned to select one year from dropdown with the years....
For example year=2024
How to?
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top