Home How to click on all ng-if that equal text via Chrome console
Reply: 1

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

phil o.O
1#
phil o.O Published in 2018-01-12 16:57:08Z

Trying to figure out how to click on all elements that equal a specific state. I see the page is written in angular. I do not know what version. I'm trying to use the chrome console to execute javascript so that I can click on all elements whose ng-if is equal to !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>
phil o.O
2#
phil o.O Reply to 2018-01-12 17:29:40Z
var aTags = document.getElementsByTagName("a");
var searchText = "  Follow";

for (var i = 0; i < aTags.length; i++) {
  if (aTags[i].textContent == searchText) {
    aTags[i].click();
  }
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.304814 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO