議論 » 開発

Trying to make a script that automatically presses certain buttons

Me
§
投稿日: 2018/01/10

Trying to make a script that automatically presses certain buttons

There are multiple buttons of this type Open as well as other buttons that do not say "Open", I would like to only click the ones that say "Open".
This is what I have so far:
var el = document.querySelector(".button");
if (el && (el.textContent.trim() == 'Open')) {
el.click();

The only issue is that this only takes the first button on the page, which is not an "Open" button. Is there an alternative to querySelector I can use? and would it be wise to use a while loop to click the rest of the buttons afterwards?

返信を投稿

返信を投稿するにはログインしてください

长期地址
遇到问题?请前往 GitHub 提 Issues。