How would I automate this?

redmoon

Regular Member
Joined
Aug 19, 2009
Messages
246
Reaction score
74
Is there any way to automate this code to submit votes like it was done with a mouse click? I'm thinking it could be done with php but I have no idea how to code it. Appreciate any help.

Code:
<input class="submit yes" type="submit" onclick="submitVote(XXXX, XXXX, 'Y')" value="Yes" name="vote">
 
You can go for simple Ruby scripts with watir.

Code:
   require 'watir'   # the watir controller

   # set a variable
   test_site = 'yoursite web site'
  
   # open the IE browser
   ie = Watir::IE.new

   
   ie.goto(test_site)

  #For signing into ur site
   
    $ie.text_field(:name, "Email").set("YourEmail")
    $ie.text_field(:name, "Passwd").set("password")
    $ie.button(:value, "Sign in").click

   #clicking on the vote button 

   $ie.button(:value, "Yes").click

PM me if You need some clarifications
 
Look up a tool called selenium its a website testing software with an API for all major programming languages, its really cool and one of the best for programatically building bots since it controls a real browser
 
Do you have any experience with JavaScript or JQuery? You can do a form.submit style form submission within a callback function if you had a form you wanted submitted in your html. Since javascript is a client side language, this is probably the easiest way to accomplish what you're trying to do. Rubyscript, as suggested above, may be an acceptable alternative. Not a fan of ruby, myself, so I don't have much experience with that option.

If you would like code samples for reference, just let me know.
 
Back
Top