Registering Android on a Selenium Grid

I noticed some misinformation floating around the web that you can’t register Android nodes on a Selenium Grid.  To set the record straight: you can do this.  You probably just need a couple things. 1. port forward external requests to the local port that adb has set up (or patch adb to accept connections external […]

I noticed some misinformation floating around the web that you can’t register Android nodes on a Selenium Grid.  To set the record straight: you can do this.  You probably just need a couple things.

1. port forward external requests to the local port that adb has set up (or patch adb to accept connections external locations)

2. send a chunk of javascript to the hub registering the node on the hub

The first part I can describe if people want me to, but it’s already an FAQ on the AndroidDriver wiki. I’ll only point out the alternative, which is to patch adb to accept all incoming connection like so (thanks to rxwen for that — the original post is here if you want more).

The second part is less communicated but not too complicated, either.  The hub just needs to be told that a node is ready for action and you do that by sending it a piece of javascript.  You can generate and send that javascript yourself, or use one of these methods:

  1. ‘flynnid’ python script, by Dave Hunt
  2. my bash script

My bash script isn’t very fancy: I wrote it in a situation where I didn’t want to install python just to send a tiny piece of javascript to the hub.  FlynnID has a couple more bells and whistles that you might prefer instead.

Like Dave mentions on his blog, the next thing to do would be to get the AndroidDriver apk itself to send this little piece of javascript.  In the meantime, hope this helps dispel the notion that Android can’t play on the grid.

Copyright information