Click on the web page button, there are 2 with the same ID

0

They could support me, I am making a macro in VBA and I need to give click in the CONFIRMAR button. The problem is that there are 2 buttons with the same ID and honestly I have no idea how to do it.

I enclose the HTML :

<div class="btn" id="botonesDiv">
    <a class="button" id="btnCont" onclick="javascript: regresarListado();" href="javascript: void(0)">
        <span>CANCELAR</span>
    </a>
    <a class="button" id="btnCont" onclick="javascript: capturaCorreoContratacion();" href="javascript: void(0)">
        <span>CONFIRMAR</span>
    </a>
</div>
    
asked by Sands AnD 21.12.2018 в 18:37
source

1 answer

1

use a css attribute selector

ie.document.querySelector("[onclick*='Contratacion']").click
  • Select the elements whose attribute attr has a value that contains (*) value.
answered by 22.12.2018 / 23:01
source