I have an applescript program that executes javascript in Google Chrome's front browser tab.
Whenever my script is run, I need to select the element with data-id play-pause and .click it. I cannot use jQuery as it's not included with the document.
Is there a way in pure javascript that I can do this?
(I'm sure there's probably a way to import it so I could use it but I'm not going down that path for a simple program.)
From IE8 and up you can use querySelector, or querySelectorAll if there's more than one element
document.querySelector('[data-id="play-pause"]').click();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With