Click all buttons on a site that match a criteria

So I work with this proprietary system, which means I can't share too much of the details of the system in a public forum, but I'm hoping I can get some help and direction.

This is a test building platform, and on the test building screen, you can search for things to add to the test, and from those results click a button labeled Add for each item. I'm in need of creating tests from long search results, and looking to avoid having to click the Add button hundreds of times.

The page works with javascript, so the buttons all have the same label of "Add".

I'm hoping there might be a way to have some plugin or macro that clicks all the buttons labeled Add?
LVL 2
musickmannData AnalystAsked:
Who is Participating?
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.

Mark BullockQA Engineer IIICommented:
You may be able to use Selenium IDE to record some actions, then play it back. It's simple to try.
It works with Firefox.
Install the Firefox plugin, launch it and it starts recording your interaction with the active web page.
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
While the data may be private, the coding is not.  You can certainly spend a little time and recreate the code into a short example using fake data and only enough info to help you http://sscce.org/

Is this a site you control or are you trying to auto hit buttons on another site?
0
musickmannData AnalystAuthor Commented:
I don't have control of the site, I'm just a front end user. I know they are working on improvements, but this is down on their list of critical needs, so my task will remain tedious for the time being.

I can certainly provide pieces of the front end code, just not sure what would be the most help. The actual buttons are coded thus:

<span class="addItemBadge badge badge-inverse pull-left" style="cursor:pointer">Add</span>

The page is setup with infinite scroll, so it loads 20 or so, then as you scroll, more results load in.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
That is bootstrap2 code.

You don't need the bootstrap js or css other than for this sample to show what the basic unstyled version looks like.  See the jquery inside the script tag that will perform the click.

If this is not your site, there may be a reason you are not able to click many items at once by design and you should check with the site's Terms Of Service before executing any automatic functions.

http://jsbin.com/zusezi/1/edit?html,output
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery.min.js"></script>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <script>
    $(function(){
       $(".addItemBadge").each(function(){
         $(this).click();
         alert("clicked");
      });
   });
  </script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<span class="addItemBadge badge badge-inverse pull-left" style="cursor:pointer">Add</span>
  <span class="addItemBadge badge badge-inverse pull-left" style="cursor:pointer">Add</span>
  <span class="addItemBadge badge badge-inverse pull-left" style="cursor:pointer">Add</span>
  <span class="addItemBadge badge badge-inverse pull-left" style="cursor:pointer">Add</span>
  <span class="addItemBadge badge badge-inverse pull-left" style="cursor:pointer">Add</span>
  <span class="addItemBadge badge badge-inverse pull-left" style="cursor:pointer">Add</span>
</body>
</html>

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
musickmannData AnalystAuthor Commented:
First off - sorry for the long delay, I thought I had replied to this already, then got side tracked with the project.

Wow, that's pretty cool. Since I work for the company, and I have asked the dev team about this, it is something they plan to implement on a future version, but at the moment, they don't have the bandwidth to accomplish this, they are okay with my finding alternate solutions. Since I have a customer that has a need to do this on a very large scale, this is awesome.

I'm not sure I am executing the best way, so wanted to check - I'm using chrome. I opened the developer console and paste the script code into the console, which loops through the page. Is that the best way of approaching this?
0
musickmannData AnalystAuthor Commented:
A great solution, does exactly what I need and also gives me some ideas to accomplish some other necessary tasks!
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.