Click on every instance of the word "Follow" with JQuery

I'm trying to get the bot to continuously scan the page for any instances for the word "Follow" (But also checking that it is not "Following") and then click on all of these instances but with a set delay between each click. Is there any way to do this?
Cyrus CookAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
What is "instances" ? a link ? a div ? any HTML element ?
0
C CCommented:
Instances as in every time the text appears, it could be in a div, could be a link or could be in an element, all it means is every time it appears on the page
0
leakim971PluritechnicianCommented:
what should happen for <div> Follow and Following</div> ?
0
leakim971PluritechnicianCommented:
	jQuery(function($) {
		var checkForFollow = function() {
			var t = 0;
// https://api.jquery.com/all-selector/
// https://api.jquery.com/not-selector/
// https://api.jquery.com/has-selector/
// http://api.jquery.com/filter/
			$("body *:not(:has(*)):not('script,link'):contains('Follow')").filter(function() {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test
				return /Follow[^i]*/.test($(this).text());
// https://api.jquery.com/each/
			}).each(function(i,v) {
				var that = this;
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout
				setTimeout(function() {
					$(that).click();
					//window.location.href = $(that).attr("href");
				}, t * 1000); // click on every link found every 10s
				t++;
			});
		};
		checkForFollow();
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval
		setInterval(checkForFollow, 10 * 60 * 1000); // check the page every 10 min for the word "Follow"
	});

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.