PDA

View Full Version : VBA for click on BUTTON Internet DOCUMENT



lulupatel
10-13-2018, 05:18 AM
Dear Sir


I am Trying to click on button by VBA on internet document. but did not get successes. getting some error.


here bellow is my URL


https://www.justdial.com/Ahmedabad/Simran-Skin-Hair-Beauty-Clinic-Near-Judges-Banglows-Bodakdev/079PXX79-XX79-160917190026-I9L7_BZDET


here bellow is my Code



Public Sub JDLOGIN()


'On Error Resume Next
Dim Sn As Integer
Dim ie As Object
Dim url As String
Dim Doc As HTMLDocument

url = "https://www.justdial.com/Ahmedabad/Simran-Skin-Hair-Beauty-Clinic-Near-Judges-Banglows-Bodakdev/079PXX79-XX79-160917190026-I9L7_BZDET"
Set ie = CreateObject("InternetExplorer.Application")


With ie
.Visible = 0
.navigate url
While .Busy Or .readyState <> 4
DoEvents
Wend
End With


Call ie.document.parentWindow.execScript("javascript:submt_os('2','whatsapptriggeer','whatsapptriggeer')")




End Sub





my be you will not get this ID "whatsaaptriggeer" in html in your PC/Laptop, because they need mobile number first to enter.


find my HTML


https://pastebin.com/1s8mkzij


you can that ID in this HTML in Row no. 25


please help me out how can I click this button by VBA

tttin20
10-19-2018, 03:16 AM
Dear lulupatel,

On the IE, choose "inspect element" of the button you want to click. If you got the ID, hope this segment code may help your problem:


Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop

For Each elem In IE.document.GetElementsByTagName("INPUT")
If elem.ID = "ButtonID" Then
elem.Click
Exit For
End If
Next elem