[Tutorial] Simple AddMeFast bot using Selenium

ikstob

Junior Member
Joined
Nov 12, 2012
Messages
147
Reaction score
130
I'm working on a handful of bots/tools which will all be free/open-source for the community to use and improve upon. In some cases they'll do some pretty advanced things on their own, in other cases they'll give you a base to build easily build your own tools and methods. I just wanted to share a simple example of how to use Selenium to automate a mind-numbingly boring task. This example is all written in Java but you could do much the same thing using Selenium's Python or C# bindings.

Basically this example is a working AddMeFast bot ... it just logs into Facebook, logs into AddMeFast, and then sits doing the "Facebook Likes" task all day long :)

Some of the neat tricks you can do from Selenium is inject JavaScript into the current page, this makes clicking buttons etc. very easy. Check the source code below (i'm too new to post the link, but figure it out). Because its all Java code you can run it on Windows, Mac or inexpensive Linux VPS's very easily.

Source code: gist_github_com/4113207

Skill required: Intermediate

Requirements:
- Java 1.6
- Java development environment Eclipse/Netbeans
- Libraries for Selenium
 
Last edited:
this is noobish question but do i need some software or what????
 
Yes, you will need a basic Java build environment such as Eclipse IDE and the necessary libraries from Selenium. I'm preparing a series of tutorials from beginners to advanced levels about 'botting' from Java - check back soon?
 
I'm working on a handful of bots/tools which will all be free/open-source for the community to use and improve upon. In some cases they'll do some pretty advanced things on their own, in other cases they'll give you a base to build easily build your own tools and methods. I just wanted to share a simple example of how to use Selenium to automate a mind-numbingly boring task. This example is all written in Java but you could do much the same thing using Selenium's Python or C# bindings.

Basically this example is a working AddMeFast bot ... it just logs into Facebook, logs into AddMeFast, and then sits doing the "Facebook Likes" task all day long :)

Some of the neat tricks you can do from Selenium is inject JavaScript into the current page, this makes clicking buttons etc. very easy. Check the source code below (i'm too new to post the link, but figure it out). Because its all Java code you can run it on Windows, Mac or inexpensive Linux VPS's very easily.

Source code: gist_github_com/4113207

Skill required: Intermediate

Requirements:
- Java 1.6
- Java development environment Eclipse/Netbeans
- Libraries for Selenium

That's an awesome library mate (Selenium), and great implementation :) I was doing this before through .NET's default browser (IE) and an extremely limited library
that made automating submit actions such as buttons frustrating.
 
Yeah, Selenium is an awesome library, using it every day. Currently, I am trying to improve the htmlunit-driver, which unfortunately leaks memory. Anybody else facing this?


For those who are not familiar with git (like me), get the jkstob stuff with

git clone git://gist.github.com/4113207

nice starter though.
 
Thanks for your comments metra & cooooookies, that was just a really basic starter .. more people should really be using Selenium - it rocks! :)

The "htmlunit-driver" is definitely a bit buggy/leaky, I've opted for using real browsers (Firefox/Chrome) running "headless" on Linux VPS's using the X virtual frame buffer (Xvfb). I can run 8-10 sessions reliably on an expensive VPS. It turns out my code was a little over-efficient racking up 6,000 points doing Facebook likes until I got hit with Phone Verification, on the bright side it made me implement the code to do Twitter following/tweets, Pinterest follows and YouTube views/likes. (will post updated code shortly)
 
Woah, I never knew Java was that similar to C#! Anyway, cheers shall be trying this out :)
 
If you use Apache Maven (a Java-based compile/build tool) to build/run this example its a piece of cake, here is the Maven pom.xml file gist_github_com/4119305 and I've done a short video of an updated version which does YouTube views and solves the captcha challenge: youtu_be/0FV4eNEjLaA

Happy Hacking! :)

Logs of the bot running during the above video:
Code:
16:23:26,574  INFO AddMeFastBot:414 - Starting task 'youtube_views'...
... snip ...
16:49:58,838  INFO AddMeFastBot:288 -    ... 'watching' video
16:50:28,839  INFO AddMeFastBot:319 -    ... solving captcha
16:50:30,146  INFO AddMeFastBot:77 - 40 views, 1153 points, running for 1624 seconds
16:50:38,847  INFO AddMeFastBot:288 -    ... 'watching' video
16:51:08,848  INFO AddMeFastBot:319 -    ... solving captcha
16:51:10,110  INFO AddMeFastBot:77 - 41 views, 1158 points, running for 1664 seconds
16:51:17,509  INFO AddMeFastBot:288 -    ... 'watching' video
16:51:47,510  INFO AddMeFastBot:319 -    ... solving captcha
16:51:48,788  INFO AddMeFastBot:77 - 42 views, 1163 points, running for 1703 seconds
16:51:56,971  INFO AddMeFastBot:288 -    ... 'watching' video
16:52:26,972  INFO AddMeFastBot:319 -    ... solving captcha
16:52:28,228  INFO AddMeFastBot:77 - 43 views, 1168 points, running for 1742 seconds
16:52:39,164  INFO AddMeFastBot:288 -    ... 'watching' video
16:53:09,165  INFO AddMeFastBot:319 -    ... solving captcha
16:53:10,438  INFO AddMeFastBot:77 - 44 views, 1169 points, running for 1784 seconds
 
Last edited:
If you use Apache Maven (a Java-based compile/build tool) to build/run this example its a piece of cake, here is the Maven pom.xml file gist_github_com/4119305 and I've done a short video of an updated version which does YouTube views and solves the captcha challenge: youtu_be/0FV4eNEjLaA

Happy Hacking! :)

Logs of the bot running during the above video:
Code:
16:23:26,574  INFO AddMeFastBot:414 - Starting task 'youtube_views'...
... snip ...
16:49:58,838  INFO AddMeFastBot:288 -    ... 'watching' video
16:50:28,839  INFO AddMeFastBot:319 -    ... solving captcha
16:50:30,146  INFO AddMeFastBot:77 - 40 views, 1153 points, running for 1624 seconds
16:50:38,847  INFO AddMeFastBot:288 -    ... 'watching' video
16:51:08,848  INFO AddMeFastBot:319 -    ... solving captcha
16:51:10,110  INFO AddMeFastBot:77 - 41 views, 1158 points, running for 1664 seconds
16:51:17,509  INFO AddMeFastBot:288 -    ... 'watching' video
16:51:47,510  INFO AddMeFastBot:319 -    ... solving captcha
16:51:48,788  INFO AddMeFastBot:77 - 42 views, 1163 points, running for 1703 seconds
16:51:56,971  INFO AddMeFastBot:288 -    ... 'watching' video
16:52:26,972  INFO AddMeFastBot:319 -    ... solving captcha
16:52:28,228  INFO AddMeFastBot:77 - 43 views, 1168 points, running for 1742 seconds
16:52:39,164  INFO AddMeFastBot:288 -    ... 'watching' video
16:53:09,165  INFO AddMeFastBot:319 -    ... solving captcha
16:53:10,438  INFO AddMeFastBot:77 - 44 views, 1169 points, running for 1784 seconds

Oh man, I cannot figure this maven thing out for the life in me... Ummm could you link me the library files that I need to import into eclipse? :)
 
Sure, no problem Selenium includes just about everything there is as dependencies! :o)

I've just chucked the first commit into GitHub you can get the example source, all the dependencies and the build file from: ikstob_com or go direct to GitHub: github_com/ikstob/botski
 
This is the first I've heard of Selenium, the example makes it look like a piece of cake though! Will definitely look into using this for some future plans, thanks a million!
 
I've just updated the example code and added a README to the GitHub project: github_com/ikstob/botski

Just to re-iterate, this is just example code .. but its *very* easy to extend it to do many more things.
 
ikstob I'm also java progammer PM your skype, maybe we could do something together..
 
Thanks for the code I guess but it's pretty much useless as we are not programmers and to get this thing up and running is a real pain in the ass.
 
OP, how does your bot solve the U-tube views captcha (the "select image with false position" one) ?
tnx
 
Back
Top