The following code uses Helium to implement a bot for the popular Likes-trading platform AddMeFast:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

import static com.heliumhq.API.*;

public class AddMeFastBot {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("AddMeFast username:");
        String addmefastUser = sc.nextLine();
        System.out.println("AddMeFast password:");
        String addmefastPw = sc.nextLine();
        System.out.println("Twitter username:");
        String twitterUser = sc.nextLine();
        System.out.println("Twitter password:");
        String twitterPw = sc.nextLine();

        startChrome();

        // First, ensure we're logged into Twitter:
        goTo("twitter.com");
        write(twitterUser, into("Username or email"));
        write(twitterPw, into("Password"));
        click("Sign in");

        // Log in to AddMeFast:
        goTo("addmefast.com");
        write(addmefastUser, into("Email"));
        write(addmefastPw, into("Password"));
        click("Login");

        // Now follow as many pages as possible:
        goTo("http://addmefast.com/free_points/twitter");
        Config.setImplicitWaitSecs(10);
        while (true) {
            try {
                final String pageTitle = getPageTitle();
                click("Follow");
                boolean alreadyFollowing = Button("Following").exists();
                boolean pageDoesNotExist = Text("Sorry, that page").exists();
                if (alreadyFollowing || pageDoesNotExist) {
                    getDriver().close();
                    click("Skip");
                } else {
                    List<Button> followBtns = findAll(Button("Follow"));
                    Collections.sort(followBtns, new Comparator<Button>() {
                        @Override
                        public int compare(Button b1, Button b2) {
                            return b1.getY() - b2.getY();
                        }
                    });
                    Button topmostFollowBtn = followBtns.get(0);
                    click(topmostFollowBtn);
                    getDriver().close();
                }
                ExpectedCondition<Boolean> pageTitleChanged = 
                    new ExpectedCondition<Boolean>() {
                        @Override
                        public Boolean apply(WebDriver input) {
                            return ! getPageTitle().equals(pageTitle);
                        }
                    };
                waitUntil(pageTitleChanged);
            } catch (Exception e) {
                System.out.println("Got " + e + ". Restarting...");
                goTo("http://addmefast.com/free_points/twitter");
            }
        }
    }
    private static String getPageTitle() {
        return $(".fb_page_title").getWebElement().getText();
    }
}
from helium.api import *

ADDMEFAST_USER = raw_input("AddMeFast username: ")
ADDMEFAST_PW = raw_input("AddMeFast password: ")
TWITTER_USER = raw_input("Twitter username: ")
TWITTER_PW = raw_input("Twitter password: ")

start_chrome()

# First, ensure we're logged into Twitter:
go_to('twitter.com')
write(TWITTER_USER, into="Username or email")
write(TWITTER_PW, into="Password")
click("Sign in")

# Log in to AddMeFast:
go_to("addmefast.com")
write(ADDMEFAST_USER, into="Email")
write(ADDMEFAST_PW, into="Password")
click("Login")

# Now follow as many pages as possible:
go_to("http://addmefast.com/free_points/twitter")
Config.implicit_wait_secs = 10
while True:
    try:
        get_page_title = lambda: S('.fb_page_title').web_element.text
        page_title = get_page_title()
        click("Follow")
        already_following = Button("Following").exists()
        page_does_not_exist = Text("Sorry, that page").exists()
        if already_following or page_does_not_exist:
            get_driver().close()
            click("Skip")
        else:
            follow_btns = find_all(Button("Follow"))
            topmost_follow_btn = sorted(follow_btns, key=lambda btn: btn.y)[0]
            click(topmost_follow_btn)
            get_driver().close()
        wait_until(lambda: get_page_title() != page_title)
    except Exception as e:
        print 'Got %r. Restarting...' % e
        go_to("http://addmefast.com/free_points/twitter")

When run, the script first prompts you for your AddMeFast and Twitter account credentials. Once you have supplied them, it logs into Twitter and AddMeFast. Finally, it keeps following pages suggested by AddMeFast for earning points.

To run the script for yourself, first follow the few simple steps on our Getting Started page. Then, execute the script run.bat/run.sh in the examples/AddMeFast Bot subdirectory of your Helium installation.