Hello everybody.
I need to automate the logon into Ariba Network Buyer and, for that, I need to click on the "Next" button in the first screen (after introducing the user name).
But that button is a span element and all my efforts till now were useless - no success with "click" method neither with "onmousedown". Below is my code:
Sub automateAriba()
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
Dim HTMLSpans As MSHTML.IHTMLElementCollection
Dim HTMLSpan As MSHTML.IHTMLElement
IE.Visible = True
IE.Navigate "Ariba Network Buyer"
Do While IE.ReadyState <> READYSTATE_COMPLETE
Loop
Set HTMLDoc = IE.Document
Set HTMLInput = HTMLDoc.getElementById("userid")
HTMLInput.Value = "mirelmo"
Set HTMLSpans = HTMLDoc.getElementsByTagName("span")
For Each HTMLSpan In HTMLSpans
' Debug.Print HTMLSpan.className, HTMLSpan.tagName, HTMLSpan.ID, HTMLSpan.innerText
' Debug.Print HTMLSpan.getAttribute("classname")
If HTMLSpan.className = "next-button-text" Then
HTMLSpan.Click
Exit For
End If
Next HTMLSpan
End Sub
Here is a capture from HTML code for that element:
Thank you.
Mirel
I need to automate the logon into Ariba Network Buyer and, for that, I need to click on the "Next" button in the first screen (after introducing the user name).
But that button is a span element and all my efforts till now were useless - no success with "click" method neither with "onmousedown". Below is my code:
Sub automateAriba()
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
Dim HTMLSpans As MSHTML.IHTMLElementCollection
Dim HTMLSpan As MSHTML.IHTMLElement
IE.Visible = True
IE.Navigate "Ariba Network Buyer"
Do While IE.ReadyState <> READYSTATE_COMPLETE
Loop
Set HTMLDoc = IE.Document
Set HTMLInput = HTMLDoc.getElementById("userid")
HTMLInput.Value = "mirelmo"
Set HTMLSpans = HTMLDoc.getElementsByTagName("span")
For Each HTMLSpan In HTMLSpans
' Debug.Print HTMLSpan.className, HTMLSpan.tagName, HTMLSpan.ID, HTMLSpan.innerText
' Debug.Print HTMLSpan.getAttribute("classname")
If HTMLSpan.className = "next-button-text" Then
HTMLSpan.Click
Exit For
End If
Next HTMLSpan
End Sub
Here is a capture from HTML code for that element:
Thank you.
Mirel