Skip to content

Instantly share code, notes, and snippets.

@stackedsax
Created May 3, 2012 01:55
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stackedsax/2582499 to your computer and use it in GitHub Desktop.
Save stackedsax/2582499 to your computer and use it in GitHub Desktop.
poor man's flynnid.py for registering android emulators in bash
#!/bin/bash
HUB_HOST="hostname"
HUB_PORT="4444"
LOCAL_IP="ip"
SOCAT_PORT="8081"
JSON="{'configuration': {'registerCycle': 5000, 'hub': 'http://<HUB_HOST>:<HUB_PORT>/grid/register', 'host': '<LOCAL_IP>', 'proxy': 'org.openqa.grid.selenium.proxy.DefaultRemoteProxy', 'maxSession': 1, 'port': <SOCAT_PORT>, 'hubPort': <HUB_PORT>, 'hubHost': '<HUB_HOST>', 'url': 'http://<LOCAL_IP>:<SOCAT_PORT>', 'remoteHost': 'http://<LOCAL_IP>:<SOCAT_PORT>', 'register': true, 'role': 'node'}, 'class': 'org.openqa.grid.common.RegistrationRequest', 'capabilities': [{'seleniumProtocol': 'WebDriver', 'platform': 'ANDROID', 'browserName': 'android', 'version': null, 'maxInstances': 1}]}"
JSON=${JSON//<HUB_HOST>/$HUB_HOST}
JSON=${JSON//<HUB_PORT>/$HUB_PORT}
JSON=${JSON//<LOCAL_IP>/$LOCAL_IP}
JSON=${JSON//<SOCAT_PORT>/$SOCAT_PORT}
echo json is: ${JSON}
curl -X POST -d "${JSON}" http://$HUB_HOST:$HUB_PORT/grid/register
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment