Im trying to click on a span element on a website I accesed with Username and Password, I´ve tried all the possible ways I can imagine(most of these found on this website). Maybe you can help me out, this is the code I´m using:
Sub internet_explore()
Dim ie As InternetExplorer
Dim page As HTMLDocument
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.Navigate2 "TheWebPage"
Do While ie.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
'Here I enter code to do the login and make a search by filling an input box and clicking on search button
'wait for the search to load up
Do While ie.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
Set page = ie.Document
Dim e as HTMLElementCollection
Dim c As HTMLButtonElement
For Each e In page.getElementsByTagName("span")
If e.innerText = "10.180.9.1" Then
Set c = e
c.click
c.parentElement.click
End If
Next
End Sub
This is what I search and the button I click: what I Search
The Result I get(Table) and why I need to click on that span element since i get many results: Results
<div class="x-grid3-cell-inner x-grid3-col-column7" style="CURSOR: pointer" unselectable="on"><span class="Grid-Panel-All">10.180.9.1<div>