[英]Collect the full list of buttons to follow without having to scroll the page (DevTools Google Chrome)
[英]Use Google Chrome DevTools to click on the "Follow" buttons on the page
我当前的脚本:
document.querySelectorAll('.components-button components-button-size-mini components-button-type-orange desktop components-button-inline').forEach(btn => btn.click());
我无法理解为什么它不起作用,直到上周我发送脚本并点击输入按钮时一切正常,现在这种情况不再发生。
我需要调整什么才能使其正常工作?
当您想要定位包含您指定的所有类的元素时,您需要用点分隔 class 名称。 例如:
<div class="my-class another-class" />
document.querySelector('.my-class.another-class')
你所拥有的是一些带有 class 的元素 .components .components-button
包含另一个元素名为components-button-size-mini
的元素,其中包含另一个名为components-button-type-orange
元素,依此类推。 当然,在这个示例中,我认为您没有具有此类名称的实际元素。
因此,要修复您的代码,请遵循我上面为选择器字符串提供的模式:
.some-class.another-class.yet-another-class
以上将针对具有指定的三个类的元素: some-class
、 another-class
和yet-another-class
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.