Chrome console auto click button by text

Chrome console auto click button by text



I have a local javascript in Firefox/Chrome that generates a family tree. It has a button that is auto generated and each instance of the button has an incremented id from the one previous.


Firefox/Chrome


button id="family376" onclick="generateFamily(376)" title="Get Family"
style="display: none;">Family</button>



Which calls this:


function onclick(event)
generateFamily(376)



If I click this button it disappears and generates children that also have the chances to have a Family button.


Family



The following code works up to a point but I need to set a delay instead of pressing them all at once. It only takes about five generations to lock up the tab its running in.


javascript:document.querySelectorAll('button[id^="family"]:not([style])').forEach(function(ele) ele.click())



This next code I believe I actually found here but obviously doesn't work. It needs an int instead of the button title I believe, which I can't provide. I also have to be careful about the fact that the buttons are hidden after clicked and not actually removed.


javascript: (function($) $(document).ready(function() setInterval(function() $(‘family’').click(); , 0.1) ); )(jQuery);



I also tried using xpath, but once again the buttons are enumerated incrementally.


//*[@id="family376"]



I've tried writing code that increments the id but have no idea how to concatenate with js.



So, my actual question is? How do I auto-click visible buttons with title="Get Family with a small delay between each click.


title="Get Family






Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Malaysia to Papua New Guinea by motorcycle?

List of Bhojpuri films

PHP code is not being executed, instead code shows on the page