Introduction: Running Selenium Using Intel Edison (Python)

Setting up Selenium
web-driver my be intimidating, especially when you are moving towards IoT. It is even more challenging working on an IoT without any display, running headless.

Step 1: Setting Up Your Intel Edison

The first step if you have not done so, start the installation guide on your Intel Edison. Be sure to walk through all five steps (the number of steps during the time of this writing). You need a Edison board with you to complete all five. The next step I HIGHLY recommend is to perform this patch that will EXPAND your partition on your system. Since you bought a 4GIG device, you should be able to use it. The Intel Edison software current does not have this fix in place yet. Hopefully this article will inspire them to do so. WARNING: If you decide to skip this step, do NOT perform opkg update more than once on your Edison. Else, you will run out of space on your Edison and have to reflash your Edison.

Step 2: Connecting and Updating Your Edison

If you haven't done

so, plug in the power to the barrel connector. I HIGHLY recommend powering from a transformer brick from a standard 120v AV to 9-12v DC converter. The Edison will adapt the voltage to 9V.

Using the standard non-Apple, mirco-USB cable, attach it to the micro-USB port closest towards the edge of the Edison (the one away from the switch).

Find what COMM port it is using and open a serial terminal. This step will vary based on your OS and the port number your computer assigns it to.

Once you get in, you need to first install the pip command which allows you to get the Python libraries. Note: Python comes pre-installed. Issue the following commands in your serial terminal or shell.

echo "src intel-iotdk" > /etc/opkg/intel-iotdk.conf

opkg update

opkg upgrade

Create a file called base-feeds.conf in /etc/opkg. (The instructions for that are below. If you are not familiar with VI, I highly recommend learning it)

vi /etc/opkg/base-feeds.conf

src/gz all

src/gz edison

src/gz core2-32

opkg update

opkg install python-pip

pip install --upgrade pip

Step 3: Installing Selenium and PhantomJS

This is the where

you you get selenium

pip install selenium

In order to use selenium headless, you need a headless browser. The easiest one to use so far is PhantomJS. To get this, the command is:

npm install phantomjs-prebuilt

(Do not use npm install phantomjs)

Step 4: Learning From Example

The template of your

code should resemble this one

from selenium import webdriver

from selenium.webdriver.common.keys import Keys

driver = webdriver.PhantomJS()


assert "Python" in driver.title

elem = driver.find_element_by_name("q")



assert "No results found." not in driver.page_source