Android Testing With Selenium Grid 2

496 views
Skip to first unread message

chri...@caseware.com

unread,
Sep 5, 2013, 6:08:13 PM9/5/13
to seleniu...@googlegroups.com
I've been able to connect android devices/emulators to grid2 on my own Win7 machine. However, when trying to repeat the exact process on a dedicated machine that will be used to execute the tests I am running into errors with port forwarding. The dedicated machine is running dual boot of Windows 7 and Ubuntu 12.04.3 LTS and I run into similar port forwarding errors using socat on either OS.

After getting the device/emulator Here are the steps that have worked for me on my own Win7 machine:

Andoid Setup
  • Install android server to the device >> adb -s emulator-5554 -e install -r  android-server-2.32.0.apk
  • Start Android WebDriver >> adb -emulator-5554 shell am start -a android.intent.action.MAIN -n org.openqa.selenium.android.app/.MainActivity
  • Setup port forwarding from host machine to emulator >> adb -emulator-5554 forward tcp:8082 tcp:8080
Grid Setup

  • Register node to selenium grid2 >> java -jar selenium-server-standalone-2.35.0.jar -role node -nodeConfig androidTabletNode.json
{
'configuration': 
{
'registerCycle': 5000, 
'host': '192.168.214.112', 
'proxy': 'org.openqa.grid.selenium.proxy.DefaultRemoteProxy', 
'maxSession': 1, 
'port': 8081, 
'hubPort': 4444, 
'hubHost': 'tdjenkins', 
'remoteHost': 'http://192.168.214.112:8081', 
'register': true, 
'role': 'node'
}, 
'class': 'org.openqa.grid.common.RegistrationRequest', 
'capabilities': 
[
{
'seleniumProtocol': 'WebDriver', 
'platform': 'ANDROID', 
'browserName': 'android', 
'version': null, 
'maxInstances': 1,
'environment': 'tablet'
}
]
}

  • Forward ports using socat >> socat TCP-LISTEN:8081,fork TCP:localhost:8082

This has worked fine for me on my own desktop, as well as two colleagues of mine. However, when I tried to repeat this process on the dedicated machine I run into the following error:
  • With the selenium node already registered, when I try to run the socat command I get an error saying 
    socat[3116] E bind(3, {AF=2 0.0.0.0:8081}, 16): Address already in use
  • If I close the selenium node terminal and run the socat command first it works fine, but then when I try to register the node again I get this error 
    Sep 05, 2013 6:01:40 PM org.openqa.grid.selenium.GridLauncher main
    INFO: Launching a selenium grid node
    Sep 05, 2013 6:01:40 PM org.openqa.grid.internal.utils.SelfRegisteringRemote startRemoteServer
    WARNING: error getting the parameters from the hub. The node may end up with wrong timeouts.Connection to http://127.0.0.1:4444 refused
    18:01:40.852 INFO - Java: Oracle Corporation 23.25-b01
    18:01:40.853 INFO - OS: Linux 3.8.0-29-generic amd64
    18:01:40.858 INFO - v2.35.0, with Core v2.35.0. Built from revision c916b9d
    18:01:41.007 INFO - RemoteWebDriver instances should connect to:http://127.0.0.1:8081/wd/hub
    18:01:41.007 INFO - Version Jetty/5.1.x
    18:01:41.008 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
    18:01:41.008 INFO - Started HttpContext[/selenium-server,/selenium-server]
    18:01:41.009 INFO - Started HttpContext[/,/]
    18:01:45.376 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@44c99f45
    18:01:45.376 INFO - Started HttpContext[/wd,/wd]
    18:01:45.377 WARN - Failed to start: SocketL...@0.0.0.0:8888
    Exception in thread "main" java.net.BindException: Selenium is already running on port 8081. Or some other service is.

        at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:491)
        at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:300)
        at org.openqa.grid.internal.utils.SelfRegisteringRemote.startRemoteServer(SelfRegisteringRemote.java:135)
        at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:111)

I guess what is happening is once the node registers then the port is taken by the node and then socat cannot listen on that port. Or if socat is listening on that port then the node cannot be registered on that port. The thing is it's been working perfectly fine until I tried to set this up on new dedicated machine. Since, I have tried on a few other machines and nothing is working on them either. 

Does someone have any experience with this? I have been trying things out for a couple weeks now with no real progress...HELP!

Reply all
Reply to author
Forward
0 new messages