VBA To Click Web Button With Dynamic ElementID And Repetitive Class
I am quite new to VBA/html, trying to automate filling a form, but cannot even call it ... I searched the web for weeks tried many different code combinations, but none got me ther
Solution 1:
Try the following code. It is hard to give any solution without playing with that site. They are always hypothetical.
Sub GetClick()
Dim IE As New InternetExplorer, Html As HTMLDocument
With IE
.Visible = True
.Navigate "https://company.application.com/home/index.cfm?Tab=home"
While .Busy = True Or .ReadyState < 4: DoEvents: Wend
Set Html = .Document
End With
''If the problem still persists, make sure to put here some delay
Html.querySelector(".clickable[id^='ext-eng']").Click
End Sub
Another approach might be something like (if the word "Text" didn't appear anywhere with the same class name):
For Each elem In Html.getElementsByClassName("clickable")
If InStr(elem.innerText, "Text") > 0 Then elem.Click: Exit For
Next elem
Reference to add:
Microsoft Internet Controls
Microsoft HTML Object Library
Post a Comment for "VBA To Click Web Button With Dynamic ElementID And Repetitive Class"