PUT value in web text box and press CERCA

User avatar
sal21
PlatinumLounger
Posts: 4534
Joined: 26 Apr 2010, 17:36

PUT value in web text box and press CERCA

Post by sal21 »

https://www.ufficiocamerale.it/trova-azienda

based this link, how to put value in INSERISCI LA PARTITA IVA, end press CERCA...?

Tks

myValue="02916070606"

progress:

Code: Select all

Sub LIST_PIVA() 'VAT

    Const URL As String = "https://www.ufficiocamerale.it/trova-azienda"

    Dim oHtml As HTMLDocument, post As Object, R&
    Dim Elements As IHTMLElementCollection
    Dim Element As IHTMLElement

    Set IE = CreateObject("InternetExplorer.Application")

    With IE
        .Visible = True
        .navigate URL
        Do While .Busy: DoEvents: Loop
        While .Busy Or .readyState < 4: DoEvents: Wend
        Set oHtml = .document
    End With

    Sleep (500)

    oHtml.getElementById("search_input").Value = "02916070606"
    
    Sleep (500)

    Dim ButtonElement As MSHTML.HTMLButtonElement
    
    IE.document.getElementsByClassName("btn btn-primary btn-sm text-uppercase")(0).Click
    
    Do While IE.Busy: DoEvents: Loop
    While IE.Busy Or IE.readyState < 4: DoEvents: Wend

    'For Each ButtonElement In IE.document.getElementsByTagName("BUTTON")
        'Debug.Print ButtonElement.className
        'If ButtonElement.className = "btn btn-primary btn-sm text-uppercase" Then
        '    ButtonElement.Click
         '   Exit Sub
        'End If
    'Next ButtonElement

    For Each post In oHtml.getElementById("search_input").getElementsByTagName("td")
        'COLLEGIO = post.innerText
        'SQL = "INSERT INTO COLLEGI ([COLLEGIO]) VALUES " & _
         "('" & Replace(COLLEGIO, "'", "''") & "')"
        'CN.Execute SQL, , adCmdText + adExecuteNoRecords
    Next

    'If Not (RS Is Nothing) Then
    'If (RS.State And adStateOpen) = adStateOpen Then RS.Close
    'Set RS = Nothing
    'End If

    'SQL = "SELECT COLLEGIO FROM COLLEGI"
    'Set RS = New ADODB.Recordset
    'RS.CursorLocation = adUseClient
    'RS.Open Source:=SQL, _
     ActiveConnection:=CN, _
     CursorType:=adOpenForwardOnly, _
     LockType:=adLockReadOnly
    'RS.Sort = ("COLLEGIO ASC")

    'Do While Not RS.EOF
    'COLLEGIO = RS.Fields(0).Value
    'Call SELEZIONA_COLLEGIO
    'RS.MoveNext
    'Loop

    'If Not (RS Is Nothing) Then
    '    If (RS.State And adStateOpen) = adStateOpen Then RS.Close
    '    Set RS = Nothing
    'End If

End Sub

now i need to get the bold value in the table response , after the line:

IE.document.getElementsByClassName("btn btn-primary btn-sm text-uppercase")(0).Click
You do not have the required permissions to view the files attached to this post.