Solved

Automatic clicking of a button on a page

Posted on 2013-06-03
7
147 Views
Last Modified: 2013-06-19
Hi JS Gurus

I work on bidding cars from a auction site. For the past few months I have been constantly losing on any car that I bid in. I strongly suspect that our competitors use a program to bid rather than human way.

I want a simple javascript program that can automate my bidding process.  This is the process that i follow:

      a. First find a list of cars that i am interested in bidding
      b. For each of this car, I  go to the final confirmation page to buy
      c. The bid opens exactly at 4 . At 4 , the final confirmation page will have a button visible - "Submit your bid". I can get the id of the button and code behind it.
      
      
My need is to write a simple JS browser extension where by the code checks the page every few milliseconds and checks for the availability of the button and if it's found , clicks the button .
As I previously mentioned the button appears only at 4PM, so the code has to run milliseconds before 4 and I should be able to configure the time to execute it in milliseconds
It has to work in chrome & FF
      
Many thanks
Sun
0
Comment
Question by:EEJUser
  • 3
  • 3
7 Comments
 

Author Comment

by:EEJUser
ID: 39218967
any takers?
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39219469
A browser extension is not a trivial piece of work.  We handle questions, this is a project, and you need to hire someone who is in the business of developing browser addons.

Cd&
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 39219621
Not THAT hard.

(function() { 
  var tId1 = setInterval(function() { 
    var t = new Date(); 
    if(t.getHours()==15 && t.getMinutes()==59 && t.getSeconds()==59) { 
      clearInterval(tId1);
      var tId2=setInterval(function() {
        var but = document.getElementById('someButton');
        if (but) {
          clearInterval(tId2);
          but.click();
        }
      },10);
    }
  },1000); /* every second */
})();

Open in new window

0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:EEJUser
ID: 39220084
Thanks mplungjan. But does this code refresh the page if the button is not found?

Cobol - Even a javascript code would do , no browser addon required. thanks

- Sun
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 39220247
No. For that you need an HTA and an iframe
0
 

Author Comment

by:EEJUser
ID: 39238798
Hi
SOrry could you explain little about HTA with a example please?

Thanks
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 39239225
Save as test.hta and run from a windows box' file system
<html>
<head>
<title></title>
<script>
var tId = "";
function monitor() {
  var but = window.frames["myIframe"].document.getElementById('button1');
  if (but) {
     clearInterval(tId);
     but.click();
     return;
  }
  else window.frames["myIframe"].reload(1);
}
</script>
<body>
<iframe name="myIframe" onload="monitor()" src="somepage.html"></iframe>
</body>
</html>

Open in new window


DISCLAIMER: you may violate the terms and conditions of the site
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now