Remove all your friends from Facebook.

Very rarely, you will want to delete all friends from Facebook and start a “fresh” facebook account.

Now, it’s hard to do this manually. Thanks to phpunit + selenium + a few lines of code, this can be done now.

The following script removes all your friends from facebook 🙂 Replace and with your username and password respectively.

require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class Example extends PHPUnit_Extensions_SeleniumTestCase
  protected function setUp()
  public function testMyTestCase()
    $this->type("email", "<username>");
    $this->type("pass", "<password>");
    for($i=0; $i<1000; $i++) {

1. The script will stop in between with timeout error. You probably should run this script in an infinite loop.
2. Once you’ve reached 0 friends, facebook blocks you from adding friends in bulk for 2 days. So, you probably have to wait till facebook trusts you as human and not a bot. 🙂

Happy hacking 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.