Automated logging of TBs and GeoCoins at

16 11 2009

I have taken up a new hobby called Geocaching some months ago, where you run around with a GPS device in order to find hidden “caches” along the countryside. One thing that you can find in these caches are so-called “trackables” which own a tracking number. You enter this tracking number on the website to claim that you have seen and maybe have taken the trackable item.

When attending an event together with other Geocachers, the number of trackable items present can become really big – there were over 80 of them for the last get-together that I went to. Since I don’t want to track all of these items by hand, I remembered about the possibility to automate web browsers with Selenium. After I got a list of the tracking numbers, I wrote a small script to handle the “Discover It!” requests to the website.

Here it is:


  $trackables = array('ABCDEF', 'GHIJKL', 'MNOPQR', 'STUVWX');

  // load API
  require_once 'Testing/Selenium.php';
  $selenium = new Testing_Selenium('*firefox /opt/firefox/firefox-bin', '');
  $result = $selenium->start();


  // login
  $selenium->type('id=ctl00_ContentBody_myUsername', '___YOUR_ACCOUNT_NAME___');
  $selenium->type('id=ctl00_ContentBody_myPassword', '___YOUR_ACCOUNT_PASS___');

  // discover trackables
  foreach ($trackables as $track) {

    $selenium->click('link=Found It? Log it!');
    $selenium->select('id=LogBookPanel1_ddLogType', 'label=Discovered It');
    $selenium->type('id=LogBookPanel1_tbCode', $track);
    $selenium->type('id=LogBookPanel1_tbLogInfo', '___DISCOVER_MESSAGE___');

  // close browser




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: