繁体   English   中英

如何通过Chrome控制台单击所有ng-if相等的文本

[英]How to click on all ng-if that equal text via Chrome console

试图弄清楚如何单击等于特定状态的所有元素。 我看到页面是用斜角书写的。 我不知道什么版本。 我正在尝试使用chrome控制台执行javascript,以便可以单击ng-if等于!isFollowing所有元素。

<div class="follow-button ng-scope" ng-if="Auth.user._id &amp;&amp; Auth.user._id != follower._id">
    <!-- ngIf: !isFollowing -->
    <a ng-if="!isFollowing" ng-click="follow()" class="ng-scope md-ideaspark-theme">  Follow</a>
    <!-- end ngIf: !isFollowing -->
    <!-- ngIf: isFollowing -->
</div>
var aTags = document.getElementsByTagName("a");
var searchText = "  Follow";

for (var i = 0; i < aTags.length; i++) {
  if (aTags[i].textContent == searchText) {
    aTags[i].click();
  }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM