I want to automate processes from an internal website. I cannot download selenium or any other external application (github is blocked).
I run reports and audit the information being entered from a couple of vendors.
I am trying to automate clicking three edit buttons in a ric Grid. The only unique characteristic I can find is the specific cell within the grid contained in the onclick command.
<a id="idf3" href="#" onclick="Ricola.page.showPleaseWait('Loading ...'); var wcall=wicketAjaxGet('?wicket:interface=:3:gridCheckGroup:ricGridContainer:ricGrid:rows:1:cells:15:cell:editLink::IBehaviorListener:0:',null,null, function() {return Wicket.$('idf3') != null;}.bind(this));return !wcall;"><span>Edit</span></a><span>/</span>
<a id="idf4" href="#" onclick="var wcall=wicketAjaxGet('?wicket:interface=:3: gridCheckGroup:ricGridContainer:ricGrid:rows:1:cells:15:cell:deleteLink::IBehaviorListener:0:',null,null, function() {return Wicket.$('idf4') != null;}.bind(this));return !wcall;"><span>Delete</span></a>
<a id="idfd" href="#" onclick="Ricola.page.showPleaseWait('Loading...'); var wcall=wicketAjaxGet('?wicket:interface=:3: gridCheckGroup:ricGridContainer:ricGrid:rows:2:cells:15:cell:editLink::IBehaviorListener:0:',null,null, function() {return Wicket.$('idfd') != null;}.bind(this));return !wcall;"><span>Edit</span></a><span>/</span>
<a id="idfe" href="#" onclick="var wcall=wicketAjaxGet('?wicket:interface=:3: gridCheckGroup:ricGridContainer:ricGrid:rows:2:cells:15:cell:deleteLink::IBehaviorListener:0:',null,null, function() {return Wicket.$('idfe') != null;}.bind(this));return !wcall;"><span>Delete</span></a>
<a id="id107" href="#" onclick="Ricola.page.showPleaseWait('Loading...'); var wcall=wicketAjaxGet('?wicket:interface=:3: gridCheckGroup:ricGridContainer:ricGrid:rows:3:cells:15:cell:editLink::IBehaviorListener:0:',null,null, function() {return Wicket.$('id107') != null;}.bind(this));return !wcall;"><span>Edit</span></a><span>/</span>
<a id="id108" href="#" onclick="var wcall=wicketAjaxGet('?wicket:interface=:3: gridCheckGroup:ricGridContainer:ricGrid:rows:3:cells:15:cell:deleteLink::IBehaviorListener:0:',null,null, function() {return Wicket.$('id108') != null;}.bind(this));return !wcall;"><span>Delete</span></a>
The code above appears on the website like this:
Edit/Delete links in their cells

In some records there will be only one Edit button, others may have up to eight. These will be the only <span>Edit</span> elements on the pages.
I am able to click the first Edit button using this code:
'Click the Edit Button
Dim edButton As Object
Application.Wait (Now + TimeSerial(0, 0, 1))
Set edButton = htmlDoc.getElementsByTagName("span")
For Each e In edButton
If e.innerText = "Edit" Then
e.Click
Exit For
End If
Next e
I am unsure how to loop this because from what I've read, the innertext cannot be indexed because it's not an object.
I then tried:
'Click the Edit Button
Dim edButton As Object
Set edButton = htmlDoc.querySelectorAll("[span=Edit]").click
This gave me
Run-time error'-2147352319 (80020101)': Automation error.
None of the situations I found seem to apply other than Ajax can be picky with syntax.
I do have the Microsoft HTML Object Library, Microsoft Internet Controls, Microsoft XML, v6.0, Microsoft Script Control 1.0 and Microsoft Scripting Runtime for added References.
Ideally, I'd like to loop through the Edit buttons as an automated process as it can be time consuming to manually click them all. Again, there is no way to know if there will only be one edit link or up to eight.