htmljquerycssselectorgoogle-chrome-console

Want to click all buttons with certain class with chrome Console. Is this possible?


I am trying to click all buttons with this class:btn btn-primary collapsed

<button class="btn btn-primary collapsed" type="button" data-toggle="collapse" data-target="#1" aria-expanded="false" aria-controls="collapseDetall">
                                                    Detalle
                                                </button>

The only difference between this and other buttons is the innerText and Class. I tried putting this on the Chrome Console without success. Due to limitations I``m not able to inject JS from Selenium or other sources, I just can use Chrome console.

$(function(){
    $('.btn btn-primary collapsed').on('click',function(e){

    });
})

I tried to look into the css for the button ID or name without success. It´s encrypted. Any help appreciated


Solution

  • Solved like this

     $(".btn.btn-primary.collapsed").trigger("click");