以编程方式单击 Chrome 控制台中页面上的所有按钮

2022-01-11 00:00:00 console google-chrome jquery html

我正在尝试使用 Chrome 控制台选择页面中的所有按钮并以编程方式单击它们.与我正在玩的页面类似的页面是:http://api.openstack.org/api-ref.html#compute-ext

I'm trying to use the Chrome console to select all the buttons in a page and click them programmatically. A similar page to what I'm playing with is this one: http://api.openstack.org/api-ref.html#compute-ext

我已经尝试执行下面的命令,但它没有达到我想要的效果.

I already tried to execute the command below but it didn't do what I wanted.

$("btn small info").click()

这可能吗?我应该发出什么命令?

Is this possible at all? What command should I issue?

推荐答案

好吧,您要确保只选择该部分中的按钮,这样您就不会运行搜索.

Well, you want to make sure you only select the buttons in the section so you are not running the search.

$("#body .btn").trigger("click");

相关文章