Introduction to PhantomJS

Posted on: March 14th, 2017 by Olu No Comments

Hi folks,

In this post I briefly go through how to navigate pages using PhantomJS perhaps while writing automated UI tests, scraping web pages, etc. To facilitate this we will use the example code supplied by PhantomJS itself [1].


Let’s look at the first chunk of the code

"use strict";
var sys = require("system"),
    page = require("webpage").create(),
    logResources = false,
    step1url = "http://en.wikipedia.org/wiki/DOM_events",
    step2url = "http://en.wikipedia.org/wiki/DOM_events#Event_flow";

if (sys.args.length > 1 && sys.args[1] === "-v") {
    logResources = true;

In the first line we create an object of sys module which we use later on to check the number of arguments. That’s useful if your script is going to accept arguments. The important bit, though, is the page = require(“webpage”).create() line. That creates a page.


Next, to open a page, we use code like


setTimeout(function() {
    console.log("### STEP 1: Load '" + step1url + "'");
}, 0);


That is, we call open() method on the page object. Notice how we wait for 0 seconds before making this call. For subsequent calls one waits for longer periods of time.


Next, to click a line on a page, we can use code like

setTimeout(function() {
    console.log("### STEP 3: Click on page internal link (aka FRAGMENT)");
    page.evaluate(function() {
        var ev = document.createEvent("MouseEvents");
        ev.initEvent("click", true, true);
}, 10000);


Notice how we create a MouseEvents object and call initEvent method on that object, passing “click” to it. Then we dispatch the event on the selector we want to click.


Finally, in a PhantomJS script, it’s good to close out the page and exit PhantomJS. We do that using code as shown below:

setTimeout(function() {
    console.log("### STEP 5: Close page and shutdown (with a delay)");
    }, 100);
}, 20000);


To see a more full-fledged example, check out Amir Duran’s excellent example of using PhantomJS to log in to Amazon [2]. The PhantomJS website [3] also has lots of good examples demonstrating usage. That’s all for now. Happy coding.



1. Page Events example. https://raw.githubusercontent.com/ariya/phantomjs/master/examples/page_events.js.

2. How to login Amazon using PhantomJS – Working example | Code Epicenter.

3. Examples | PhantomJS. http://phantomjs.org/examples/

Bash Scripting Introduction

Posted on: February 17th, 2017 by Olu No Comments

Hi folks, this article is meant to be a really short introduction to Bash.

First, what is Bash? Bash is a Unix shell and command language developed by Brian Fox for the GNU Project as a free software replacement for the Bourne shell [1]. Bash is the default shell on most Linux and macOS systems. Bash has even been ported to Windows as it is supported natively in Windows 10 and through Cygwin and MinGW. A Bash script is a file containing one or commands and can be very useful to automate commands that you may otherwise have to type out yourself each time on a terminal. Without further ado, let’s dive in.


Interpreter Directive

A common way to write Bash scripts is to add an interpreter directive as the first line of the file, e.g.

This way, once the file is made executable, a user can execute the file directly from a terminal and it will be executed with Bash automatically.


Variable assignment

Variable assignment is done as follows:

x="some tuff"

Note that there shouldn’t be space between the letter and the = sign.

Referencing variables


echo y is $y


If conditions

Here is an example of how to write an if statement.

if [ $x == "some stuff" ]
echo some stuff


If/else conditional statement

if [ $x == "stuff" ]
echo some stuff
echo some other stuff


If/else if/else clause

if [ $x == "foo" ]
echo some stuff
elif [ $x == "bar" ]
echo some other stuff
echo the last stuff


myArray=(1 2 3)


While Loop Through an Array

myArray=(1 2 3)
while [ "x${myArray[count]}" != "x" ]
echo element is ${myArray[count]}
count=$(( $count + 1 ))


You can find much more details in Mike G’s excellent BASH Programming website [2].



1. Bash (Unix shell) – Wikipedia. view-source:https://en.wikipedia.org/wiki/Bash_(Unix_shell) [16/02/17].

2. BASH Programming – Introduction HOW-TO. http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html [16/02/17].

Incredible Brick Breaker 1.2. is Launched

Posted on: January 11th, 2016 by Olu No Comments

Hi folks,

We’ll like to announce that Incredible Brick Breaker 1.2 has been released. This is a minor update and contains a fix for the bug where the app crashes on navigating from the Main Menu to the About page and back to the Main Menu. Some usability improvements were also implemented.

As always, we like to know what you think about the game. Fell free to contact us. And if you haven’t yet installed the game, get it from Google Play.

Yinkos Grocery List App 2.1 is Live!

Posted on: November 16th, 2015 by Olu No Comments

Hi folks,

We’re pleased to announce that Yinkos 2.1 is out.

This update includes usability improvements like making Backup and Recovery easier to access for your shopping lists. There is also a bug fix for a bug with using the Barcode scanner. This version also uses a more up-to-date version of the Android SDK for a more modern look. The online shopping aspect has been removed from this version and will likely be rolled out as a separate app soon.

Get it from Google Play.

Incredible Brick Breaker 1.1 is Launched!

Posted on: October 12th, 2014 by Olu No Comments

Hi folks,

First, I’ll like to say thanks to everyone who has installed Incredible Brick Breaker so far. It’s a pleasure to see others enjoying the game as much as we are. Now to the point at hand. Incredible Brick Breaker 1.1 is out! It went live last night.

This release includes a few bug fixes to navigation within the app. In the near future we should be including a few more feature to spice up the game even further. As always, we like to know what you think about the game. Fell free to contact us. And if you haven’t yet installed the game, get it from Google Play.

Yinkos Grocery List 1.39 is Live

Posted on: October 3rd, 2014 by Olu No Comments

Hi Folks,

It’s sure been a while, but rest assured, there are several new features in the pipeline.

For now, a bug-fix release has just been published. Yinkos 1.39 includes some fixes to for a bug affecting Facebook login on some devices.

Get it from Google Play


Incredible Brick Breaker is Launched!

Posted on: September 10th, 2014 by Olu No Comments

Hi Folks,

Good news! We have just launched an awesome Brick Breaker game on Google Play. It’s called Incredible Brick Breaker! This game is so incredible, it will knock your socks off.

You will play with fast balls, long paddles, chase after really cool power-ups while you keep the ball from hitting the ground.

Incredible Brick Breaker is a great game to play when you need something to pass time, e.g. when on the bus on the way to work, on lunch break, etc.

Try it out on Google Play today! It’s free. Get it on Google Play.


Yinkos Grocery List is now Available Throughout Google Play

Posted on: July 15th, 2014 by Olu No Comments

Hi folks,

It’s with great pleasure that we announce that Yinkos is now available in all countries supported by Google Play. The motivation behind this is to make it possible for more people to try out the app so we can know better what works and what doesn’t.

The ‘Shop in Person’ section is designed to assist a user with creating and managing shopping lists so it can come in handy regardless of what country you are located. The ‘Shop Online’ section on the other hand supports UK stores for now with hopes of expanding to other countries depending on demand.

So, get the app on Google Play today and as always we really appreciate all feedback.

Yinkos Grocery List 1.37 is Live!

Posted on: May 26th, 2014 by Olu No Comments

Hi folks,

It’s a great pleasure to announce that Yinkos 1.37 is out.


In this update, a bug in one of the home page links is fixed. Also, the splash screen has been redesigned.


More updates coming soon. Get it from Google Play.

Yinkos Grocery List 1.36 is Live!

Posted on: May 18th, 2014 by Olu No Comments

Hi folks,

It’s a great pleasure to announce that Yinkos 1.36 is here finally!


With this update comes login by Facebook and Google+, so it’s now easier than ever to sign up and start saving money with the Yinkos Grocery List and Price Comparison App. There are also minor improvements to improve usability.


Also, in this update the SHOPPING LIST section has been renamed to SHOP IN PERSON so that the title is more relevant to its purpose: to help users create and manage shopping lists when they intend to go to the grocery stores themselves.


More updates coming soon. Get it from Google Play.